Available Magento Code Sniffer rulesets

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:

Update:
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.

Leave a Reply

Your email address will not be published. Required fields are marked *