1

I'm trying to configure PHP Code Sniffer on my project, and I would like to see the error/warnings directly on the editor - like any other error, warnings.

I installed the package in composer squizlabs/php_codesniffer and configured the remote interpreter (since I'm using Docker).

If I run phpcs script the report is correctly shown:

enter image description here

At this point, I configured PhpStorm enabling Quality Tools -> PHP_CodeSniffer Validation:

enter image description here

When the code gets analyzed I don't see anything highlighted on the Editor, but appears a popup that shows an XML:

enter image description here

How can I enable editor highlight, instead of an Event popup that shows this XML?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Mistre83
  • 2,677
  • 6
  • 40
  • 77

1 Answers1

1

This is due to a bug with PhpStorm when the CLI interpreter settings are set to "Connect to existing container". If you toggle this to "Always use a new container", everything seems to work properly.

enter image description here

You can use docker container prune to remove the orphaned containers when your debugging session is complete.

You can follow https://youtrack.jetbrains.com/issue/WI-64562 and https://youtrack.jetbrains.com/issue/WI-64239 to track the status of this issue being resolved with JetBrains.

Mark Shust at M.academy
  • 6,300
  • 4
  • 32
  • 50
  • 1
    Yes, I already noticed that using "start a new container" works. The problem is about spawn new container each time and avoid use prune. I hope this will be foxed by jetbrains soon – Mistre83 Dec 20 '21 at 15:44