Inconsistent / stale PHP quality tool inspection highlights

Hello!

I am facing an issue with PHP Quality Tool, on-the-fly inspections (phpcs and phpmd in particular), having to do with the timing of when a tool is called by PhpStorm against a file VS when the file in question has been written to disk after having been modified.

When making modifications to an open file, PhpStorm calls such external tools before having saved the file to disk, which leads to inconsistent inspection highlighting in the editor, as the highlighted warnings/errors do not refer to the file contents currently being displayed, but to older ones.

This is evident if one enables the annotation of unsaved files with an asterisk (Settings > Editor > General > Editor Tabs > Mark modified) and PhpStorm's debug logging (for com.jetbrains.php), and compares the timing of the two operations (quality tool is executed VS file is persisted to disk). Based on my auto-save configuration, the file gets saved 15 whole seconds after the execution of the external quality tools (based on Settings > Appearance > System Settings > Save files if the IDE is idle for...).

I would expect that enabling any one of the supported PHP quality-tool-based inspections should implicitly force a save operation to be completed before the tool runs, as these cannot work otherwise.

Since I was unable to find any references of such an issue online, I was wondering if anyone actually uses these tools for on-the-fly inspections (as opposed to employing them in CI procedures). Could this have to do with my configuration, application version, OS etc, or is it an application bug?

This is my setup:

PhpStorm 2020.2.1
Build #PS-202.6948.87, built on August 27, 2020
Runtime version: 11.0.8+10-b944.31 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep

phpcs and phpmd both run locally, i.e. not via a remote php interpreter.

Thanks!

0
2 comments

Chances are high that you are facing this issue:

https://youtrack.jetbrains.com/issue/WI-53963 (please check duplicates as well)

 

It should be fixed in next versions that are not available yet, unfortunately.

0
Avatar
Permanently deleted user

Vasiliy many thanks! I'll wait for the bugfix then.

0

Please sign in to leave a comment.