Bug report
Even though I narrow down which $key is currently being looped over, $value still has an aggregate type of all possible keys, and does not update to become the stricter type associated with just that exact key. Anyway the snippet probably explains this better :D
It may be a feature request more than a bug I suppose.
Code snippet that reproduces the problem
https://phpstan.org/r/456203ce-8c04-406f-b7fb-556ac8d711ca
Expected output
No error