Bug report
When checking any attribute on a \stdClass, any further checks on attributes will fail, even if they succeeded before.
Code snippet that reproduces the problem
https://phpstan.org/r/721592ed-f4d1-4bb1-a7f0-047bd2183a55
declare(strict_types=1);
/** @var \stdClass[] $items */
$items = [];
foreach ($items as $item) {
foreach ($item->subItems as $subItem) {
echo $subItem->_works; // works
echo $subItem->willFail; // works
if (isset($subItem->someOtherAttribute)) {
// also fails with explicit type-hint to mixed, object and \stdClass
echo $subItem->willFail; // fails, worked before
}
}
}
Expected output
No error should occur, just like when accessing _works or the first willFail.
Bug report
When checking any attribute on a
\stdClass, any further checks on attributes will fail, even if they succeeded before.Code snippet that reproduces the problem
https://phpstan.org/r/721592ed-f4d1-4bb1-a7f0-047bd2183a55
Expected output
No error should occur, just like when accessing
_worksor the firstwillFail.