PHPStan and Xdebug

I've been upgrading some dev dependencies in my toy projects and now PHPStan seemingly requires the --xdebug flag when Xdebug is enabled (and omitting it otherwise). So now I get lots of notifications in PhpStorm when I open projects:

phpstan: ! [NOTE] The Xdebug PHP extension is active, but "--xdebug" is not used. This may slow down performance and the process ! will not halt at breakpoints.

The settings dialog apparently expects a file path, not a command, so I can't add the flag there. Do I need to create my own wrapper to replace  C:\Projects\...\vendor\bin\phpstan.bat or there's an easier solution?

0
2 comments

Hi there,

https://youtrack.jetbrains.com/issue/WI-69996/Quality-tools-phpstan-psalm-warning-if-interpreter-with-xdebug-extension-is-used

This message should not show up in 2023.1 EAP builds...

 

Do you always have Xdebug enabled? What if you use PhpStorm to only enable that extension when Debug button is used (there is an option in PHP Interpreter settings for Xdebug extension path -- https://www.jetbrains.com/help/phpstorm/php-interpreters.html#advanced-area)? Obviously, this will not be used by a web server or if you need Xdebug enabled for other reasons.

1

Oh, that's awesome. I'll just ignore the warning meanwhile.

I rarely debug CLI scripts on this machine, but thank you for the tip.

0

Please sign in to leave a comment.