Change record status: 
Project: 
Introduced in branch: 
8.3.x
Introduced in version: 
8.3.0
Description: 

In order to facilitate better coding standards for core, the Coder project and PHP_CodeSniffer are now dev requirements for the drupal/core package. This makes it much easier to give instructions (see below) on how to check for coding standards errors, and also makes it possible for the DrupalCI testbot to automate coding standards tests. As of this change notice, Drupal core requires Coder 8.2.12. This will change as new Coder versions are released, and core is updated so it meets the CS requirements.

Drupal core will continue to maintain a PHP_CodeSniffer ruleset in core/phpcs.xml.dist that represents official standards. The standards list will change over time as new standards are adopted.

Usage

First, if your installation is managed by composer or a git clone of core, ensure that your project dependencies up to date by running composer install. If you are using the tarball provided by drupal.org then checking coding standards is not supported.

Once your dependencies are up to date, you can, for example, scan the Node module by executing the following command from the command line:

vendor/bin/phpcs -p --standard=core/phpcs.xml.dist core/modules/node

Customisation

If you want to apply the rules to code outside of core and your vendor location is customised you will need to copy core/phpcs.xml.dist to some location and update the paths.

Impacts: 
Module developers
Themers