Skip to content

issue with nullable ints #577

@SignpostMarv

Description

@SignpostMarv

(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.

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);
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions