This is the default coding standard being used by Magento 2 core team.
I assume all of developers using PhpStorm or smiliar IDE to coding right now in Balance Internet. If you don't, you can contact me privately to get a key (legally) of it.
Homebrew installed
Q: Why Homebrew?
A-Short version: Why not?
A-Long version: It's apt-get/yum tool dedicated for MacOS
brew tap homebrew/homebrew-php
brew update
brew install php56
(php53 php54 php55 php70, your choices)brew install php-code-sniffer
(bonusbrew install phpmd
)
- Clone this repo to wherever you want
- Symlink it to
/usr/local/etc/php-code-sniffer/Standards
E.g:
$ git clone https://github.com/balanceinternet/coding-standard BalanceInternet_phpcs
$ ln -s BalanceInternet_phpcs/Magento /usr/local/etc/php-code-sniffer/Standards/BalanceM2
Q: Why symlink?
A: Version Control capabilities.
- Navigate to Preferences > PHP > Code Sniffer
- Set path to output of
which phpcs
and hit 'validate' - Navigate to Preferences > Inspections > PHP > PHP Code Sniffer validation and tick to enable
- Refresh 'Coding Standards' dropdown and select your preferred options (BalanceM2 obviously)