Bug report
If the values of a list are changed in a foreach where the key isn't part of the loop, the list isn't recognized as list anymore.
// $list becomes array<int<0, max>, mixed>
foreach ($list as &$value) {
$value = 'foo';
}
// $list remains list<mixed>
foreach ($list as $key => &$value) {
$value = 'foo';
}
Code snippet that reproduces the problem
https://phpstan.org/r/bd56bdd7-0fd4-423f-9086-7377e341204a
Expected output
Error is reported incorrectly.
Did PHPStan help you today? Did it make you happy in any way?
No response