phpstormphpcodesnifferphpstorm-2017.2

Trouble installing PHP Code Sniffer


I'm attempting to install PHP Code Sniffer for PhpStorm, but have been unable to get it to work. I've been following the steps here: https://confluence.jetbrains.com/display/PhpStorm/PHP+Code+Sniffer+in+PhpStorm

I added PHP Code Sniffer as a Composer dependency, and it now appears in the project directory. I then went to the code sniffer settings page, where I entered the path to the PHPCS.bat file. When I click Validate, I get an error message saying "Can not run PHP Code Sniffer".

screenshot of error

Have I missed a step or is there a log somewhere with more information on what is not working?


Solution

  • I solved the same problem by editing the phpcs.bat file and replacing the paths:

    PHPBIN=@php_bin@

    with

    PHPBIN=path\to\php.exe

    and

    "%PHPBIN%" "@bin_dir@\phpcs" %*

    with

    "%PHPBIN%" "path\to\phpcs" %*