Basically I recommend following the PSR-2 standard for Coding Style Guidelines in Magento projects. Verifying your coding styles makes sense in any case – whether you are working in a large team of developers or as a freelancer for several clients. Agreeing to one common coding standard and following the rules improves readability and comparability.
But as we all know Magento has some quirks that do not fit very well this standard (like underscore class names, underscore prefixed variables, etc.)
That’s why some people adapted the existing rulesets to Magento.
This is a short list of customized Magento Code Sniffs for phpcs:
- The ECG Coding Standard
- The FireGento Coding Standard
- Magento 2 Coding Standard
- I also created a coding standard rulset for me internally: vianetz Coding Standards (will be published soon)
An interesting discussion regarding the ECG Coding Standard can also be found on StackExchange.
Which coding standards do you use?
BTW: Here is a useful tutorial how the phpcs tool can e.g. easily be integrated into PHPStorm.