You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After generating code is finished, it can happen that (especially) bodies are formatted ugly. Thus just run the suggested code formatter after generating the code. Can be found on github gossi/php-code-formatter.
Psr-2? Spaces suck, deal with it :p Once Version 1.0 is reached, a psr-2 profile will be shipped.
Last commit is 7 month ago - so - maybe we should replace simply "\t" with $n * " " where the replace and $n is configurable? But then the problem with ugly formatted code generated by php-code-generator will stay (as far as it exists).
Well, maybe a replacement of php-code-generator is another solution.
For Example zend-code
It also has limited format options but a setIndentation() exists (defaults to 4 spaces). But the LF is set as a const to "\n". ZF3 uses PSR-2 so I assume that the generated code will follow PSR-2 (not tested)
I think the body is not an issue right now, since we have complete control over what is inside the body. Currently we use already spaces in there, however it gets indented with tabs (since you don't use indentation in the argument of ->setBody($code)).
I'm not sure where that tab is hardcoded, but maybe we can just subclass the generator/visitor that generates the actual code, replace it or make it configureable. Just replacing all \t could also be a way, although not so sexy.
Currently the used library uses tabs, I guess hardcoded. We should make it configurable.
https://github.com/gossi/php-code-generator
See
Propel3/src/Propel/Generator/Builder/Om/AbstractBuilder.php
Line 113 in e8e0db9
The text was updated successfully, but these errors were encountered: