Search code examples
phpidephpstormjetbrains-ide

PhpStorm Is throwing an error for phpcs


PHP Code Sniffer

phpcs: Can not correctly run the tool with parameters:
C:\Users\sa\AppData\Local\Temp\___0.tmp\press_home.module --encoding=utf-8
Possible tool process hangup after 5 sec.
Exclude press_home.module from PHP Code Sniffer analysis.

PhpStorm throwing this message frequently. Any idea why PhpStorm showing this error?


Solution

  • Any idea why PhpStorm showing this error?

    Extremely likely because PHP executable that is used to execute phpcs has xdebug enabled -- execution takes longer.

    Two possible solutions:

    1. Make sure that PHP executable that is used to execute phpcs has no xdebug enabled. E.g. you may disable xdebug altogether .. or have multiple PHP installations on your computer where default one (that will be used if you type php in terminal) does not have xdebug.

    2. Try increasing timeout in PhpStorm's settings (Settings/Preferences | Languages & Frameworks | PHP | Code Sniffer). On certain systems/setups even increasing timeout to 20+ seconds (which is a lot) may still unable to resolve the issue.

    Solution described in #1 is preferred from performance point of view and more reliable (but more difficult to implement, especially if you actually need xdebug locally).