PHP_CodeSniffer
On this page, enable and configure the PHP_CodeSniffer quality tool.
Item | Description |
|---|---|
Configuration | Select the required interpreter from the list. The list contains all the currently configured local and remote PHP interpreters. For more information, refer to Configure local PHP interpreters and Configure remote PHP interpreters. Clicking |
Show ignored files | Click to open the PHP_CodeSniffer Ignored Files dialog, which lists the files that PHP_CodeSniffer skips. PhpStorm suggests adding a new file to the list during inspection when waiting for response from the PHP_CodeSniffer exceeds the limit specified in the Tool process timeout field. This is done to prevent slowing down processing. For each file, PhpStorm displays its name and location.
|
Check files with extensions | Provide a comma-separated list of file extensions that should be checked by PHP_CodeSniffer. |
Show warnings as... | To have PHP_CodeSniffer report warnings in addition to errors, select the checkbox and choose the severity degree from the list. Clear the checkbox to have only errors reported and suppress reporting warnings. |
Show sniff name | Select the checkbox to have the corresponding sniff's name displayed in the editor or the inspection results in addition to the inspection summary. |
Installed standard paths | If you are relying on a custom third-party coding standard (for example, Coder or Joomla Coding Standards), you need to integrate it with PHP_CodeSniffer prior to using it. To do this, select the Installed standard paths checkbox, click |
Coding standard | Appoint the coding standard to apply.
|
Run mode | Configure how often PHP_CodeSniffer is triggered to analyze code:
|
Idle threshold (ms) | Define the delay time in milliseconds after code modification before PHP_CodeSniffer runs. |
Minimum interval (ms) | Define the minimum time in milliseconds that must pass between two consecutive runs of PHP_CodeSniffer on the same file. This prevents PHP_CodeSniffer from running too frequently in case of frequent file savings or heavy typing. |
PHP_CodeSniffer Dialog
The dialog opens when you click next to the Configuration list on the PHP_CodeSniffer page.
Use this dialog to configure the used PHP interpreter, path to the PHP_CodeSniffer executable file, as well as PHP_CodeSniffer's behaviour. For more information, refer to PHP_CodeSniffer.
Item | Description |
|---|---|
Interpreters pane | The left-hand pane of the dialog shows the default PHP interpreter to use the PHP_CodeSniffer from. To add a different interpreter, click |
PHP_CodeSniffer path | In this field, specify the location of the PHP_CodeSniffer script: phpcs.bat for Windows or phpcs for Linux and macOS. PhpStorm detects the path to the PHP_CodeSniffer executable file in the To check that the specified path to phpcs.bat or phpcs ensures interaction between PhpStorm and PHP_CodeSniffer, that is, the tool can be launched from PhpStorm and PhpStorm will receive problem reports from it, click the Validate button. This validation is equal to running the |
Tool process timeout | In this field, specify how long you want PhpStorm to wait for a result from PHP_CodeSniffer. If the timeout is exceeded, the process is terminated to prevent excessive CPU and memory usage. This lets you fine-tune the PHP_CodeSniffer process behavior depending on the configuration of your computer and the rule sets used. |
PHP Code Beautifier and Fixer Settings | In this area, provide a custom path to the PHP Code Beautifier and Fixer tool in the Path to phpcbf field. Type the path manually or click PHP Code Beautifier and Fixer lets you automatically fix many of the errors detected by PHP_CodeSniffer. |