-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Milestone
Description
(int) null is zero, if a nullable int is > 1 it is therefore not zero & cannot be null either.
One would hope that phpstan would auto-ignore this kind of conditional.
It also fails for different reasons on #556.
- master: https://phpstan.org/r/6a840b96875408e02d0a76770c677f7c
- add ConstantConditionRule #556 : https://phpstan.org/r/ae49f5b566c119a8ae157edba54088e3
class Test
{
public static function step1(? int $foo) : void
{
if ($foo > 1) {
static::step2($foo);
}
}
public static function step2(int $bar) : void
{
var_dump($bar);
}
}Reactions are currently unavailable