Propel3 icon indicating copy to clipboard operation
Propel3 copied to clipboard

[Feature] Generated code should be PSR-2 compatible

Open nymo opened this issue 6 years ago • 5 comments

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?

nymo avatar Feb 25 '18 13:02 nymo

Propel3 builders use the great php-code-generator library, that doesn't support PSR-2 until the issue https://github.com/gossi/php-code-generator/issues/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 https://github.com/gossi/php-code-generator/issues/23 not solved yet, we could think to temporarly switch to my fork.

Anyway, imho Propel should generate psr-2 classes.

cristianoc72 avatar Feb 26 '18 09:02 cristianoc72

I saw this too but as far as I could see there is not much progress to finish the issue https://github.com/gossi/php-code-generator/issues/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.

nymo avatar Feb 27 '18 06:02 nymo

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

gossi avatar Feb 27 '18 07:02 gossi

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

gossi avatar Aug 04 '18 21:08 gossi

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

delboy1978uk avatar May 17 '19 08:05 delboy1978uk