|
PHPStan support array shape and I have a class using the ArrayAccess interface so I thought that I could use the same notation see https://phpstan.org/r/8e0ac7d8-f9e9-4345-aef9-a0a75b0c7e02 But currently it gives errors. Any idea how to fix that or should this be considered as a new feature to be developed ? |
Replies: 2 comments 2 replies
|
ArrayAccess has generics where you can specify the type of keys and the type of values. It cannot be used as an array shape. |
|
Nice "workaround" I will use it for now but I still believe you should be able to use array shape style docblock on it. Since for instance you can destructure ArrayAcces like you do array. |
ArrayAccess has generics where you can specify the type of keys and the type of values. It cannot be used as an array shape.
I think this can be solved in some way, but I'm not sure if it's a good idea: https://phpstan.org/r/c2eab2d8-98a9-4f08-838e-3f39c8696609