Skip to content

Instantly share code, notes, and snippets.

@artmouse
Forked from osrecio/Magento_phpcs_Phpstorm.md
Created February 5, 2018 18:18
Show Gist options
  • Save artmouse/e7dab16c6f104cb3ced22450dbd3ed48 to your computer and use it in GitHub Desktop.
Save artmouse/e7dab16c6f104cb3ced22450dbd3ed48 to your computer and use it in GitHub Desktop.
Add PHPCS PHPStorm for Magento

Install PHPCS and add Magento Standars

composer global require magento-ecg/coding-standard
composer global require magento/marketplace-eqp
export PATH=$HOME/bin:/usr/local/bin:$PATH:$HOME/.composer/vendor/bin
phpcs --config-set installed_paths $HOME/.composer/vendor/magento-ecg/coding-standard/,$HOME/.composer/vendor/magento/marketplace-eqp/

Configure PHPCS into PHP Storm

Settings > Languages & Frameworks > PHP > CodeSniffer

put the path for phpcs (locate it with which phpcs in your terminal) and validate it, apply and we're done.

Settings > Editor > Inspections > PHP > PHP Code Sniffer validation

Enable it and search in the screen for Coding Standard and pick Ecg, EcgM2, MEQP1 and MEQP2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment