-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Milestone
Description
Summary of a problem or a feature request
Exception catch scope infers incorrect types. Apologies this isn't easy to describe and I didn't have any luck finding a similar issue. The code below is a minimum reproducer of the problem.
Code snippet that reproduces the problem
<?php declare(strict_types = 1);
/** @var \stdClass|null */
$object = null;
try {
if ($object === null) {
throw new \InvalidArgumentException();
}
throw new \RuntimeException(); // If you remove this the same error is present as well, which makes even less sense to me
} catch (\Throwable $e) {
if ($object === null) { // Strict comparison using === between stdClass and null will always evaluate to false.
}
}https://phpstan.org/r/c56d3540-d5fa-4366-8ca8-fb6bb63d2484
Expected output
No error
Reactions are currently unavailable