

Specify the full path of the PHPCS executable in the new dialog that opens (which is $YOUR_COMPOSER_BIN_PATH/phpcs). Click the “three dots button” beside the dropdown highlighted below: Expand the PHP Code Sniffer on the Quality Tools page and select Local from the Configuration dropdown. PHPStorm natively supports code inspection with PHP_CodeSniffer, though configuring it is quite some work.įirst, launch the Settings dialog (Ctrl+Alt+S) and navigate to Languages & Frameworks > PHP > Quality Tools. Red lines should appear in all the places with violations as shown below:

Note that it also searches your project root for existing rulesets (which is the purpose of the phpcs.xml file in our sample project). Once installed, restart VS Code and the plugin will automatically search your global composer path for a PHPCS installation. Type “ext install phpcs” to find the extension and.Open the Quick Open dialog on VS Code (with Ctrl+P or Cmd+P).Using PHPCS on VS Code is relatively easy as the vscode-phpcs plugin does a lot of heavy-lifting for us. The next time you modify a PHP file and save, PHPCS should run automatically and report any violations that occur in the popup menu. For a complete list of all the possible config options, you can look up the example settings in the plugin source code.
