-
-
Notifications
You must be signed in to change notification settings - Fork 933
Closed
Labels
Milestone
Description
Bug report
Code snippet that reproduces the problem
<?php declare(strict_types = 1);
function foo(int $retry): void {
echo "\nfoo: ".$retry;
throw new \Exception();
}
$retry = 2;
do {
try {
foo($retry);
break;
} catch (\Exception $e) {
if (0 === $retry) {
throw $e;
}
--$retry;
}
} while ($retry > 0);https://phpstan.org/r/da6a9ae4-f4a5-41b7-90f3-5fe8256808d1
12 | Parameter 1 $retry of function foo expects int, int|string given.
I think $retry it always an int
16 | Strict comparison using === between 0 and 2|string will always evaluate to false.
besides the string thingy the value of $retry can be 0,1 and 2 at this line
Expected output
no issues
Did PHPStan help you today? Did it make you happy in any way?
always makes me happy, been a great help in a lot of projects :)