-
-
Notifications
You must be signed in to change notification settings - Fork 933
Open
phpstan/phpstan-src
#4151Labels
Milestone
Description
Bug report
while working on phpstan/phpstan-src#3453 (comment) I realized that the current $key
narrowing for array_key_exists
is buggy, as it assumes the key can only be int|string
but because of casting rules it could be string|int|float|bool|null
see e.g. https://3v4l.org/oZVkJ
Code snippet that reproduces the problem
https://phpstan.org/r/0172cf80-e0d8-4cb5-acef-5f4884b3bd5b
Expected output
a type like mixed~(array|object)
for everything which is a string but non-numeric
Did PHPStan help you today? Did it make you happy in any way?
No response
mvorisek