layout | group | subgroup | title | menu_title | menu_order | version | github_link |
---|---|---|---|---|---|---|---|
default |
coding-standards |
Coding standards |
Code sniffers |
PHP code sniffers |
3 |
2.0 |
coding-standards/code-standard-sniffers.md |
We recommend the consistent use of a code sniffer to enhance the readability of your code and help ensure that it meets Magento code standards. A code sniffer is a tool that automates the process of identifying code irregularities. Although a sniffer will identify many more inconsistencies and errors than a manual edit, we recommend that you evaluate and make any fixes that your sniffer program identifies.
Magento recommends the use of PHP_CodeSniffer, the most popular code sniffer in use throughout the PHP development community. PHP_CodeSniffer implements the full PSR4 standard. You can extend PHP_CodeSniffer to include your own rules, too, as we have. The Magento Extension Quality Program Coding Standard provides specifications that you can use to configure your code sniffer of choice to bring your PHP coding style closer to Magento PHP standards.
Magento supports the full PSR4 standard plus some Magento-specific coding practices.
The Coding standards overview introduces Magento-specific practices for PHP, JavaScript, and JQuery.