PHP style code: How to keep its code clean with PHP Coding Standards Fix
A really useful tool to keep its code clean and use the tool PHP Coding Standards Fix
It allows us to follow the standards of PHP defined in PSR-1, PSR-2, etc… It is also possible to set up this one to follow the style of his team with documentation.
The recommended way to install it is outside its code, but if you use symfony, you can install it directly as a dependency of your project.
compose requires --dev friendsofphp/php-cs-fixer
once this is done, it can be launched in the following way
php vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix src
During the first execution, the configuration is created
And the first corrections are a must. So your code will follow the rules of PHP, PSR without you needing to be too careful during PRs.
Don’t forget to commit the file .php.cs.dist!