Fix slow analysis on return with a big OR condition#5049
Closed
staabm wants to merge 5 commits intophpstan:2.1.xfrom
Closed
Fix slow analysis on return with a big OR condition#5049staabm wants to merge 5 commits intophpstan:2.1.xfrom
staabm wants to merge 5 commits intophpstan:2.1.xfrom
Conversation
ondrejmirtes
requested changes
Feb 26, 2026
Member
ondrejmirtes
left a comment
There was a problem hiding this comment.
Reuse it for nested BooleanAnd as well
Contributor
Author
I can add a test for bool-AND but I don't think we need the fix for AND, because AND will narrow the type, not widen as OR does (so it will not produce a big union) |
Member
|
Yeah, only if you produce an example with BooleanAnd that’s slow. |
staabm
commented
Feb 26, 2026
| : "{$tag_name->namespace} {$tag_name->node_name}"; | ||
| } | ||
|
|
||
| assertType('non-falsy-string|uppercase-string', $tag_name); |
Contributor
Author
There was a problem hiding this comment.
this type is not correct, but its a pre-existing unrelated problem: created a separate issue for that
Contributor
Author
|
the failling tests make me feel the fix is wrong |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes phpstan/phpstan#14207
Regression test before PR:
After PR (equal fast as
AnalyserIntegrationTeston 2.1.x):Wordpress
phpstan analyse --debug src/wp-includes/html-api/class-wp-html-processor.php -vbefore PR:after PR: