There is no need to copy directories, to make PHP_CodeSniffer new coding standards. Just use phpcs --config-set
to set installed_paths to the extra directories containing coding standards.
phpcs --config-set installed_paths /path/to/one
If you have more directories, you can separate them with a comma.
phpcs --config-set installed_paths /path/to/one,/path/to/two
See Configuration Options.
By default, PHP_CodeSniffer will look inside its own src/Standards
directory to find installed coding standards. An installed standard appears when you use the -i
command line argument and can be referenced using a name instead of a path when using the --standard
command line argument. You can add install paths by setting the installed_paths configuration option.
When I install PHP_CodeSniffer coding standard like drupal/coder, I use the following command. (I also use Composer to install PHP_CodeSniffer.)
composer global require drupal/coder dealerdirect/phpcodesniffer-composer-installer
dealerdirect/phpcodesniffer-composer-installer is a Composer installation plugin that makes the coding standards automatically available to PHP_CodeSniffer without setting installed_paths each time new coding standards are added.