Skip to content

Fix #14124: Reassigning to array<string, list<T>> out parameter does not see the list<T> property during assignment - #5006

Merged
staabm merged 5 commits into
phpstan:2.1.xfrom
staabm:bug14124
Feb 20, 2026
Merged

staabm merged 5 commits into
phpstan:2.1.xfrom
staabm:bug14124

Conversation

@staabm

@staabm staabm commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

inspired by #4999

Fixes phpstan/phpstan#14124

staabm and others added 3 commits February 20, 2026 09:39
- Pass correctly computed valueToWrite type to VariableAssignNode instead of
  the assignedPropertyExpr expression tree which loses list types on nested
  array dimension assignments
- The assignedPropertyExpr uses setOffsetValueType for non-outermost dims,
  losing AccessoryArrayListType, while produceArrayDimFetchAssignValueToWrite
  correctly uses setExistingOffsetValueType via cross-paired dim fetch checks
- New regression test in tests/PHPStan/Rules/Variables/data/bug-14124.php

Closes phpstan/phpstan#14124
@staabm
staabm marked this pull request as ready for review February 20, 2026 08:42
@phpstan-bot

Copy link
Copy Markdown
Collaborator

This pull request has been marked as ready for review.

@VincentLanglet VincentLanglet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is two tests and three place you modify the code ; does every change is covered ?

@staabm
staabm merged commit 2295fee into phpstan:2.1.x Feb 20, 2026
638 of 643 checks passed
@staabm
staabm deleted the bug14124 branch February 20, 2026 15:14
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