A set of Magento specific PHP CodeSniffer rules.
A set of Magento rules for PHP_CodeSniffer tool.
For development puposes you can install Magento Coding Standard by cloning this GitHub repo
$ git clone email@example.com:magento/magento-coding-standard.git $ cd magento-coding-standard $ composer install
It is possible also to install a standalone application via Composer
$ composer create-project magento/magento-coding-standard --stability=dev magento-coding-standard
magento/magento-coding-standard inside your project using
composer require command.
Command should return the list of installed coding standards including Magento.
$ bin/phpcs -i
Once installed, you can run
phpcs from the command-line to analyse your code
$ bin/phpcs --standard=Magento app/code/MyAwesomeExtension
- Documentation of existing rules. See ExtDN PHP CodeSniffer rules for Magento 2 as a good example.
- Bug fixes and improvements of existing rules.
- Creation of new PHP CodeSniffer rules.
- Discussions on new rules (through periodic hangouts or discussions per GitHub issue).
- Start with looking into Community Dashboard. Any ticket in
Up for grabsis a good candidate to start.
- Didn't satisfy your requirements? Create one of three types of issues:
- Bug report - Found a bug in the code? Let us know!
- Existing rule enhancement - Know how to improve existing rules? Open an issue describe how to enhance Magento Coding Standard.
- New rule proposal - Know how to improve Magento ecosystem code quality? Do not hesitate to open a proposal.
- The issue will appear in the
Backlogcolumn of the Community Dashboard. Once it will be discussed and get
Acceptedlabel the issue will appear in the
Up for grabscolumn.
All rules should be covered by unit tests. Each
Test.php class should be accompanied by a
Test.inc file to allow for unit testing based upon the PHP CodeSniffer parent class
You can verify your code by running