Skip to content

Instantly share code, notes, and snippets.

@kraken-chris
Last active June 8, 2023 20:54
Show Gist options
  • Save kraken-chris/d2fbf369616284d403cb698511d49f76 to your computer and use it in GitHub Desktop.
Save kraken-chris/d2fbf369616284d403cb698511d49f76 to your computer and use it in GitHub Desktop.
Setup Magento PHP_Codesniffer
## Use the latest PHP_Codesniffer version
composer require squizlabs/php_codesniffer:^3.5 --dev
## Use the latest versino of Magento Coding Standard
composer require magento/magento-coding-standard:^28 --dev -W
## Make sure phpcs works
vendor/bin/phpcs -i
## Add Magento 2 Coding Standard to PHP_Codesniffer
vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/
## PHP_CS should now show "Magento2Framework"
vendor/bin/phpcs -i
## Example usage:
vendor/bin/phpcs --standard=Magento2Framework app/code/Kraken/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment