From 161a3da4b9ee4d2888b98e5f4ea1939704de06e9 Mon Sep 17 00:00:00 2001 From: Ryan Fowler Date: Mon, 1 Apr 2019 22:48:14 -0700 Subject: [PATCH] Update phpcs.md Included reference to new Magento Coding Standard phpcs and configuration of said snifferoonies. --- doc/tasks/phpcs.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/doc/tasks/phpcs.md b/doc/tasks/phpcs.md index ca2db374b..568a48e59 100644 --- a/doc/tasks/phpcs.md +++ b/doc/tasks/phpcs.md @@ -145,7 +145,7 @@ parameters: ### Magento -If you want to use Phpcs for your Magento projects, you can require the magento-ecg repo. +If you want to use Phpcs for your Magento projects, you can require the magento-ecg repo ( works with Magento 1 and Magento 2 ). ```sh composer require --dev magento-ecg/coding-standard @@ -162,6 +162,28 @@ parameters: warning_severity: 0 ``` +For Magento 2 projects, you can require the Magento Coding Standard repo. +```sh +composer require --dev magento/magento-coding-standard +``` + +Next, add the following to your `composer.json` file, and run `composer run-script post-install-cmd`. +```sh +"scripts": { + "post-install-cmd": "vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/", + "post-update-cmd": "vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/" +} +``` + +Following this, you can add the path to your phpcs task. +```yaml +# gumphp.yml +parameters: + tasks: + phpcs: + standard: "Magento2" +``` + ### Drupal If you want to use Phpcs for your Drupal projects, you can require the Drupal Code Sniffer (Coder)