Repository navigation
Widen the values of a lone shape instead of degrading it to an oversized array - #7239
Merged
Merged
Conversation
…zed array
SharedKeyShapeWidening widened the values of the shapes only once it
folded two or more of them. A single shape over the limit because of the
shapes nested in it, such as array{header: ..., message: non-empty-array<...>}
built in nested loops, went straight to OversizedArrayWidening and lost
all its keys, so optional keys such as 'transaction' were no longer
reported as possibly missing. The lone shape now keeps its keys and only
its values widen.
Amp-Thread-ID: https://ampcode.com/threads/T-01a22094-706b-72f3-83ff-6df2ad61c23f
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
SharedKeyShapeWideningwidened the values of the shapes only once it folded two or more of them. A single shape over the limit because of the shapes nested in it, such asarray{header: ..., message: non-empty-array<...>}built in nested loops, went straight toOversizedArrayWideningand lost all its keys, so optional keys such as'transaction'were no longer reported as possibly missing. The lone shape now keeps its keys and only its values widen.The issue's snippet infers the 2.3.6 type again and reports both
Offset 'transaction' might not existerrors.Closes phpstan/phpstan#15869
Amp thread: https://ampcode.com/threads/T-01a22094-706b-72f3-83ff-6df2ad61c23f