Bug report
When using switch cases with if, return and break statements then PHPStan gets confused.
Code snippet that reproduces the problem
<?php declare(strict_types = 1);
function test(int $x, int $y): int {
switch($x) {
case 0:
return 0;
case 1:
if ($y == 2) {
// continue after the switch().
break;
}
// else fall through to default clause
default:
return 99;
}
return -1;
}
https://phpstan.org/r/06e8ebd7-6062-4b53-8ad5-fd71b242fd8b
Expected output
no output because no error