propelorm/Propel3

[Feature] Generated code should be PSR-2 compatible

nymo opened this issue · 5 comments

nymo commented

I would like to see the generated code PSR-2 compatible. We could use something like templates and define PSR-2 as default but make it adjustable for other people if they prefer another code style.

What do you think?

Propel3 builders use the great php-code-generator library, that doesn't support PSR-2 until the issue
phpowermove/php-code-generator#23 is resolved.
By now, I've forked php-code-generator and refactored it to generate psr-2 code https://github.com/cristianoc72/psr2-code-generator .
When Propel3 will be finished, if phpowermove/php-code-generator#23 not solved yet, we could think to temporarly switch to my fork.

Anyway, imho Propel should generate psr-2 classes.

nymo commented

I saw this too but as far as I could see there is not much progress to finish the issue phpowermove/php-code-generator#23 .

For our issue #4 I extended the classes of the code generator but didn't liked the way I had to do this. Maybe we should use your Fork to fix issue #4 and this one until the gossi code generator supports PSR2. Would be a much cleaner way.

gossi commented

you might also think about forking the code-generator libraries so I can merge your code and all can benefit from that.

gossi commented

See phpowermove/php-code-generator#54 where I started an implementation towards psr-2. Please read, run experiments, gain experience, send PRs 😉

Use this one, It generates PSR-2 compliant code, and supports all PHP 7.x features https://packagist.org/packages/nette/php-generator