Expand description
Emulation of dealerdirect/phpcodesniffer-composer-installer
(docs/reference/plugins/phpcodesniffer-composer-installer/, MIT; 0.7.2
to 1.2.1 behave alike on an install): on post-install-cmd /
post-update-cmd, when squizlabs/php_codesniffer is installed, the
plugin registers every coding standard found in the packages of type
phpcodesniffer-standard (and in the project when the root package is
one) as PHP_CodeSniffer’s installed_paths, through
phpcs --config-set installed_paths <a>,<b>:
Finder::files()->name('ruleset.xml')at a depth betweenmin(0 for phpcs >= 3.0.0, 1 before) andmax(extra.phpcodesniffer-search-depth, 3 by default) below each search path, VCS directories skipped;- a standard’s path is the ruleset’s directory, then its parent unless
it is the project itself, made relative to the phpcs package with
findShortestPath(..., directories: true); - the paths already registered are kept when their directory still
exists, the new ones appended, the whole sorted (
sort(), bytewise) and written by phpcs into<phpcs>/CodeSniffer.conf:<?php\n $phpCodeSnifferConfig =+var_export+;\n?>; - nothing happens when nothing changed, or when no search path exists.
Constants§
Functions§
- register_
standards Plugin::onDependenciesChangedEventafter an install:packagesare the installed packages (the local repository),root_manifestthe project’s composer.json.