Conversation
56f0e9c to
803d153
Compare
|
How does this compare to your older PR? #2117 Is this issue really fixed? |
before, when the issue was reported Then I did some refactoring which didn't change behaviour. Then @staabm added in 89cfc49#diff-a408f91196cfe8e476bde977d3ceab1867fddee0b39a9bf1bb4e94ff7c1a2eb3 the check where the extension would only handle calls of And that basically fixed it, I'd say. Since then the extension didn't wrongfully use the constant array keys anymore, the type specification must be falling back to the default function definition, where the types are wider and that doesn't make problems. Difference to my solution? I tried to add support to |
|
Thank you. |
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