Bug report
Hi! I think I've found some inconsistencies in handling string array keys and the implicit cast.
Code snippet that reproduces the problem
https://phpstan.org/r/61624d33-5c41-43bf-a44f-357ef10575b5
Expected output
Some of my thoughts:
string should be considered as int|string
- Maybe there should be some enforcements asking for a non-numeric string.
numeric-string should not be considered int, but int|string too. Maybe some more specific types (int-string|float-string/numeric-string-int|numeric-string-float/numeric-string<int|float>?) would help but I don't know if it would be worth.
- Edit: even a
numeric-string<int> would still not be casted to int anyway, if it starts with 0
Did PHPStan help you today? Did it make you happy in any way?
Oh boy do I love it
Bug report
Hi! I think I've found some inconsistencies in handling string array keys and the implicit cast.
Code snippet that reproduces the problem
https://phpstan.org/r/61624d33-5c41-43bf-a44f-357ef10575b5
Expected output
Some of my thoughts:
stringshould be considered asint|stringnumeric-stringshould not be consideredint, butint|stringtoo. Maybe some more specific types (int-string|float-string/numeric-string-int|numeric-string-float/numeric-string<int|float>?) would help but I don't know if it would be worth.numeric-string<int>would still not be casted tointanyway, if it starts with0Did PHPStan help you today? Did it make you happy in any way?
Oh boy do I love it