Validation and formatting will work (see below for alternative filenames for
This extension contributes the following settings:
phpSniffer.run: When to run phpcs (the linter). Can be onSave or
phpSniffer.onTypeDelay: When phpSniffer.run is onType, this sets the
amount of milliseconds the validator will wait after typing has stopped before
it will run. The validator will also cancel an older run if the run is on the
phpSniffer.executablesFolder: The folder where both phpcs and phpcbf
executables are. Use this to specify a different executable if it is not in your
global PATH, such as when using PHP_Codesniffer as a project-scoped
dependency. Can be absolute, or relative to the workspace folder.
phpSniffer.autoDetect: Set to true for the extension to auto-detect
phpSniffer.executablesFolder as ./vendor/bin/ per workspace folder (applies
only if phpSniffer.executablesFolder is empty).
phpSniffer.standard: The standards to check against. This is passed to the
phpcbf and phpcs executables as the value for --standard. Can be absolute,
or relative to the workspace folder. If not set,
PHP_CodeSniffer will attempt to find a file to use,
at the root of the currently open file's workspace folder in the following order:
phpSniffer.snippetExcludeSniffs: Sniffs to exclude when formatting a code
snippet (such as when formatting on paste or on the command
format on selection). This is passed to the phpcbf command as the value for
--exclude when not formatting a whole file.
Windows Hanging PHP Process
When phpcs encounters a malformed array declaration, it can sometimes hang from an error.
This is exacerbated by the fact that we do not have access to the spawned php
process in the extension code and cannot kill php.exe directly. This causes
many non-exiting PHP processes on Windows machines which can really slow down
The fix for this is to update squizlabs/PHP_Codesniffer in use to >=3.4.2.