Bug report
When array destructuring is used on item inside foreach, non-existent keys are not reported even though the shape of array is well defined. Array destructuring otherwise works during regular assignment. See the linked code snipped for more details.
$arr = [['a' => 0]];
['b' => $val] = $arr[0]; // Works just fine, error is reported
foreach ($arr as ['b' => $valueB]) { // no error reported
}
Code snippet that reproduces the problem
https://phpstan.org/r/1551cc74-364f-4d99-96a8-4847ff8e084f
Expected output
Missing 'b' key should be reported.
Did PHPStan help you today? Did it make you happy in any way?
Bug report
When array destructuring is used on item inside foreach, non-existent keys are not reported even though the shape of array is well defined. Array destructuring otherwise works during regular assignment. See the linked code snipped for more details.
Code snippet that reproduces the problem
https://phpstan.org/r/1551cc74-364f-4d99-96a8-4847ff8e084f
Expected output
Missing 'b' key should be reported.
Did PHPStan help you today? Did it make you happy in any way?