Skip to content

AcceptsResult: cache Yes/No/Maybe#5095

Merged
VincentLanglet merged 1 commit intophpstan:2.1.xfrom
VincentLanglet:acceptsResults
Feb 28, 2026
Merged

AcceptsResult: cache Yes/No/Maybe#5095
VincentLanglet merged 1 commit intophpstan:2.1.xfrom
VincentLanglet:acceptsResults

Conversation

@VincentLanglet
Copy link
Contributor

I found some useless variable in lazyMaxMin, and then I found that you cached Yes/no/maybe in SuperTypeOf but not AcceptResult @staabm. I think we can do the same.

@VincentLanglet VincentLanglet changed the base branch from 2.2.x to 2.1.x February 28, 2026 13:25
@phpstan-bot
Copy link
Collaborator

You've opened the pull request against the latest branch 2.2.x. PHPStan 2.2 is not going to be released for months. If your code is relevant on 2.1.x and you want it to be released sooner, please rebase your pull request and change its target to 2.1.x.

Copy link
Contributor

@staabm staabm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

callable $callback,
): self
{
$results = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice phpstan would detect local variables which are only written but never read

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are feature requests for that. It'd be very easy to implement too I think. We'd need virtual expr nodes like PropertyInitializationExpr to track things in scope.

@VincentLanglet VincentLanglet merged commit 075e0f5 into phpstan:2.1.x Feb 28, 2026
638 of 649 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants