Closed stephanvierkant closed 5 years ago
Symfony follow PSR coding standards and the documentation recommend to use PHP CS fixer: https://symfony.com/doc/current/contributing/code/standards.html
Most of big projects (not only Symfony) are following the PSR coding standards. And since this bundle is Symfony bundle, I think we must follow PSR coding standards to keep consistency with the Symfony ecosystem.
This should not be a question about if you like it or not.
All the rules defined in the standards have been specified for a good reason.
I'm ok with following PSR standards, but they're very limited. We can follow @Symfony rules and add some extra rules (like removing useless dockblocks, remove else statements, etc.
For example: the Symfony Coding Standards allows redundant docblocks, but doesn't require them.
Another example. The idea behind the Yoda conditions is that one might write if ($foo = 'bar') {}
while $foo == 'bar') {} is ment. But
$singular = 1 === \count($diff);` is allowed. Can't get my head around this.
I'll write a PR with a coding style based on PSR/Symfony.
I think we should decide on a coding style so we can automate the process of bitching about spaces, indenting, etc. and have a better, cleaner and easier to read and maintain code.
I don't like the Symfony Coding Standard for some reasons. I don't like the Yoda comparison, but that's a personal preference. More important:
FriendsOfPHP/PHP-CS-Fixer
lacks featuressquizlabs/PHP_CodeSniffer
has.Some ideas to improve the coding style:
@package
annotation@param
or@return
if native PHP types are using.else
(early return/exit)I'll work on a PR to improve this, so please let me know if you have a opinion about this matter.