Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Track more expressions#5596

Merged
VincentLanglet merged 6 commits into
phpstan:2.1.xfrom
VincentLanglet:fixSpecify
May 5, 2026
Merged

Track more expressions#5596
VincentLanglet merged 6 commits into
phpstan:2.1.xfrom
VincentLanglet:fixSpecify

Conversation

@VincentLanglet
Copy link
Copy Markdown
Contributor

@VincentLanglet VincentLanglet commented May 4, 2026

VincentLanglet and others added 5 commits May 4, 2026 09:06
… holders

For property fetches and array dim fetches, the target type in conditional
expression holders must be computed from the right-side scope where the base
object is already narrowed. For example, `$node->name` needs `$node` narrowed
to `FuncCall` (not `CallLike`) to resolve the property type correctly.

Variables keep using the original scope to avoid breaking multi-var isset()
where the right scope has already removed null from the other variable.

Also removes a redundant `!($expr->name instanceof Name)` check that PHPStan
correctly identified as always-true after the preceding elseif branch.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@VincentLanglet VincentLanglet marked this pull request as ready for review May 4, 2026 19:02
@VincentLanglet VincentLanglet requested a review from staabm May 4, 2026 19:02
@phpstan-bot
Copy link
Copy Markdown
Collaborator

This pull request has been marked as ready for review.

Copy link
Copy Markdown
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.

I love it

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.

3 participants