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.
Closes phpstan/phpstan#3300
See also https://phpstan.org/r/f16bc296-b26d-4081-a308-7dd0416def71
Not sure if more precision for constant arrays is needed? For such an edge case the current result might be enough? My PR #2117 adds some complexity, including changes on
Type::getKeysArray()
and rebasing those changes on latest 1.11.x is not trivial after #2516 and I'm worried they would make things even more complex..The reason why this is fixed is the early exit in
phpstan-src/src/Type/Php/ArrayKeysFunctionDynamicReturnTypeExtension.php
Lines 30 to 32 in d5a4746