Nested array check #10462
-
Hello PHPStan community, I wanted to update to the current 1.10.56 and got this error, which I do not understand. I reproduced it here: https://phpstan.org/r/dccb6dd7-d944-429d-bf83-dd33e308a772 It seems that PHPStan does not correctly recognize the nested array structure 🤔 Or do I miss something here? Thanks in advance for your help 👋 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
From the looks of it I think you've missed one more nested level: https://phpstan.org/r/cabe8249-bb26-4d1a-bfbc-ec6202a6e24d It's easy to figure it out if you verify what PHPStan thinks of your type. Given your original example this is what But I think you've meant it to be |
Beta Was this translation helpful? Give feedback.
From the looks of it I think you've missed one more nested level: https://phpstan.org/r/cabe8249-bb26-4d1a-bfbc-ec6202a6e24d
It's easy to figure it out if you verify what PHPStan thinks of your type. Given your original example this is what
$response
is: https://phpstan.org/r/34a7498d-ed83-425b-9a37-5874a9149810But I think you've meant it to be
array{aggregations: array<string, array{buckets: array{key: string}}>}
, right?