Bug report
/**
* @param ArrayAccess<int, ?object> $array
*/
public function sayHello(ArrayAccess $array): void {
$child = new stdClass();
assert($array[1] === null);
$array[1] = $child;
dumpType($array[1]); // still `null`
}
The dumpType($array[1]) probably should be ?object, because unlike the array ArrayAccess may have any logic inside.
Code snippet that reproduces the problem
https://phpstan.org/r/5bb6baaf-61bc-4d50-bf3c-7921647857ed
Expected output
Dumped type: ?object.
Did PHPStan help you today? Did it make you happy in any way?
No response