[Implemented] Doctrine2php coding standarts

0 votes
asked Jan 30, 2013 in Solved by iniweb (270 points)
recategorized Feb 10, 2013 by ludek.vodicka

After i use export to php doctrine files, i has 2 spaces, but in Symfony2 project i have 4 spaces in all my (and not only my) project code.

Symfony2 use the PSR standarts - https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md

Code MUST use 4 spaces for indenting, not tabs.

And as you can see on http://www.php-fig.org/ , Doctrine use this standarts too.

commented Jan 30, 2013 by ludek.vodicka Skipper developer (140,450 points)

ORM Designer uses spacing based on analyses of destination file (tabs vs spaces and number of spaces). If 2 spaces was used, then you probably have some wrong spacing in your file.

If you didn't find a problem in your file, would it be possible to send me this file to [email protected] so we can test it and fix the possible bug? Thanks!

commented Jan 30, 2013 by iniweb (270 points)

Orm designer created this files for me with 2 spaces. Ok, then i send exported files to you.

commented Jan 30, 2013 by ludek.vodicka Skipper developer (140,450 points)
edited Jan 30, 2013 by ludek.vodicka

Oh, it's a new file created by ORM Designer. I assumed it's existing file based on "I has 2 spaces". So the problem is in default spacing for new files. Ok, I will check it.

1 Answer

0 votes
answered Feb 10, 2013 by ludek.vodicka Skipper developer (140,450 points)
selected Jul 30, 2014 by Martin Freki Stradej
 
Best answer

This issue is resolved in latest version of ORM Designer.

Based on this article http://www.php-fig.org/ we changed default spacing for all Doctrine2 projects to four spaces.

If anyone will want to update this settings manually, you can edit file Doctrine2.export.osc at line 162

phpResult.ReformatAst(true,110,"\n","    ");

and modify last parameter to any other value. Syntax of this command is

ReformatAst(reformatModifiedElementsOnly, maximumCharsOnLine, defaultNewlineChar, defaultLineIndention);
...