Skip to content

Comments

Add similar behavior for all Assign nodes#4996

Merged
VincentLanglet merged 3 commits intophpstan:2.1.xfrom
VincentLanglet:fix/12250
Feb 19, 2026
Merged

Add similar behavior for all Assign nodes#4996
VincentLanglet merged 3 commits intophpstan:2.1.xfrom
VincentLanglet:fix/12250

Conversation

@VincentLanglet
Copy link
Contributor

Inspired from #4958

Closes phpstan/phpstan#12250
Closes phpstan/phpstan#4525

phpstan-bot and others added 3 commits February 19, 2026 13:17
- Added handling for AssignOp\Coalesce in NewAssignedToPropertyVisitor
- The visitor now marks `new` expressions in `$this->prop ??= new Foo()` with the property attribute, so MutatingScope::exactInstantiation() can infer generic type parameters from the property's declared type
- New regression test in tests/PHPStan/Rules/Properties/data/bug-12250.php

Closes phpstan/phpstan#12250
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

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