PhpStorm Throws an Error for phpcs

PHP code removal

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 often throws this message. Any idea why PhpStorm is showing this error?

+6
source share
3 answers

Any idea why PhpStorm is showing this error?

It is extremely likely that phpcs is included because the PHP executable that is used to execute phpcs is enabled - it takes longer to complete.

Two possible solutions:

  • Make sure that the PHP executable used to execute phpcs does not support xdebug. For instance. you can disable xdebug .. altogether or have several PHP installations on your computer, where by default one (which will be used if you type php in the terminal) does not have xdebug.

  • Try increasing the timeout in PhpStorm settings ( Settings/Preferences | Languages & Frameworks | PHP | Code Sniffer ). In some systems / settings, even increasing the timeout to 20 seconds (which is a lot) may still not solve the problem.

The solution described in No. 1 is preferable in terms of performance and more reliable (but more difficult to implement, especially if you really need xdebug locally).

+5
source

The storm does not perceive the response from the sniffer or sniffer. Try to run it from the command line with the same parameters and see what happens, maybe you just need an update, or maybe some parameters fail. This should come with a JAVA tag since Storm is built on JAVA. Perhaps JAVA developers will know how to handle the team. In any case, this has nothing to do with php.

0
source

The increase in timeout should be applied only if you have good reasons (complex data, remote connection, etc.), but most scenarios are quickly analyzed.

Potential solution for your problem: You are not providing a code standard as a parameter, so make sure PHPStorm calls phpcs with the correct coding standard, so the --standard parameter can cause problems.

In PHPStorm under "Settings-> Editor->" Inspections ", expand the" PHP "node and go to the PHP Sniffer check. There you should find a drop-down list with the inscription" Coding Standard ".

I would not recommend using MyServer as the default value unless you have a good reason, instead choose PSR2, for example.

The following command will be issued by PHPStorm, in this case:

 phpcs.bat index.php --standard=PSR2 --encoding=utf-8 --report=xml 
0
source

All Articles