-
Notifications
You must be signed in to change notification settings - Fork 572
Fix phpstan/phpstan#14333: Setting an array key doesn't update a reference #5257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
VincentLanglet
merged 22 commits into
phpstan:2.1.x
from
phpstan-bot:create-pull-request/patch-bsc1yhl
Mar 23, 2026
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
a2dc7f2
Fix phpstan/phpstan#14333: Setting an array key doesn't update a refe…
VincentLanglet cee3ee4
Add test for nested array reference tracking limitation
phpstan-bot 452ef48
Skip implicit-key by-ref tracking when index is uncertain due to non-…
phpstan-bot 5f2bb40
Simplify
VincentLanglet ba41a09
Fix
VincentLanglet 9b8aef9
Implement nested array reference tracking
phpstan-bot 408e173
Simplify
VincentLanglet d3c6ba1
Add comment explaining why implicitIndex is set to null for non-const…
phpstan-bot 94ce927
Move intertwined ref preservation from assignVariable to invalidateEx…
phpstan-bot 2418eaa
Move intertwined ref preservation condition into shouldInvalidateExpr…
phpstan-bot 138d9dd
Simplify
VincentLanglet 0d5dc30
Rename and simplify isDimFetchPathReachable to absorb nested check
phpstan-bot da620de
Add failing test
VincentLanglet 5837156
Fix lint
VincentLanglet 0222fd8
Prevent circular back-propagation of intertwined refs during variable…
phpstan-bot e7d6282
Add test for multi-scalar key values in array by-ref tracking
phpstan-bot 2c00eda
Use toArrayKey() for proper array key coercion and add tests for mult…
phpstan-bot 0b7b5e1
Add tests
VincentLanglet 5a99dab
Use toArrayKey() for proper array key coercion and add tests for mult…
phpstan-bot c621e9e
Remove dim expression coercion, fix HasOffsetValueType key coercion i…
phpstan-bot eda0fc1
Check isConstantScalarValue() on coerced array key type in HasOffsetV…
phpstan-bot 08498ff
Apply toArrayKey() before isConstantScalarValue() check in HasOffsetV…
phpstan-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the mutation suggestests this might need/miss a test with either integer-range and/or union of integers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests also confirmed passing (11,631 tests, 78,867 assertions). Everything is done and pushed.