Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Xdebug note #2052

Closed

Conversation

InvisibleSmiley
Copy link

@InvisibleSmiley InvisibleSmiley commented Dec 5, 2022

Coming from #1878 (comment)

I thought a lot about how to put all the "requirements" from phpstan/phpstan#8173 into a single warning message. In the end I found that there's a dilemma we cannot solve:

  • on the one hand, we want a short and precise message
  • on the other hand, we ideally want to convey multiple messages at the same time, namely the issue that breakpoints are ignored, and the performance impact that running Xdebug induces

In fact I think the actual (potential) problem we want to highlight here is the missed breakpoints issue. The Xdebug performance impact seems negligible to me because it is only equal to the time that it takes to restart PHPStan, which is "constant" compared to the overall time it takes to analyse any target source code (cf. my simple benchmark for a medium-sized project).

You may want to "educate" people not to have Xdebug enabled in order to improve performance, but I really think this is not the way to go.

If you really, really want me to come up with a lengthy message that does include all of that, please let me know and I'll give it another shot.

@staabm
Copy link
Contributor

staabm commented Dec 5, 2022

On my mac running make in the phpstan project, when Xdebug is enabled, is considerably slower then with xdebug disabled. IIRC it at least doubles the time to run make

@InvisibleSmiley
Copy link
Author

I guess make here calls phpstan multiple times which would be a special case that justifies disabling Xdebug for that purpose.
I'm talking about the (hopefully) normal case where phpstan is invoked only once to analyze a whole project.

@staabm
Copy link
Contributor

staabm commented Dec 5, 2022

fwiw, I created a PR for phpcs so it also auto-restarts when xdebug is enabled: squizlabs/PHP_CodeSniffer#3724

@InvisibleSmiley
Copy link
Author

FTR (future versions of) PhpStorm will now filter out these messages, provided the prefix (first sentence) does not change:
JetBrains/phpstorm-phpstan-plugin@5b252d3

My proposed changes do not alter the first sentence so they won't affect PhpStorm's filtering.

@ondrejmirtes
Copy link
Member

@InvisibleSmiley That's just a bad coding practice. The form of textual messages for the end-user are not meant to stay the same and be machine-readable. I'd rather prefer it the authors reached out to me via GitHub issues and asked for something reliable instead.

@InvisibleSmiley
Copy link
Author

The form of textual messages for the end-user are not meant to stay the same and be machine-readable.

That was just FYI. I'm fine with changing the message in any way here and PhpStorm has to adapt to that.

The reasonings that I did take into account are described in my initial comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants