Bug report
When accessing an array either for reading or writing, the index type MUST be a sub-type of array-key.
PHPStan seems to allow generics that do not have an array-key constraint.
This is a problem because it gives a false sense of safety, as it could lead to type errors at runtime: https://3v4l.org/u0tJV
Code snippet that reproduces the problem
https://phpstan.org/r/4dfc8a86-b078-4a82-b675-93b250a4ef1a
Expected output
Error: Attempting to access an array index using Tk, expected a sub-type of array-key
Did PHPStan help you today? Did it make you happy in any way?
No response
Bug report
When accessing an array either for reading or writing, the index type MUST be a sub-type of
array-key.PHPStan seems to allow generics that do not have an
array-keyconstraint.This is a problem because it gives a false sense of safety, as it could lead to type errors at runtime: https://3v4l.org/u0tJV
Code snippet that reproduces the problem
https://phpstan.org/r/4dfc8a86-b078-4a82-b675-93b250a4ef1a
Expected output
Error: Attempting to access an array index using
Tk, expected a sub-type ofarray-keyDid PHPStan help you today? Did it make you happy in any way?
No response