Skip to content

Internal Error: Argument 1 passed to PHPStan\Type\IntegereRangeType::fromInterval() must be of the type integer or null, float given #4010

@PrinsFrank

Description

@PrinsFrank

Bug report

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------
         Internal error: Argument 1 passed to PHPStan\Type\IntegerRangeType::fromInterval() must be of the type integer or null, float given, called in
         phar:///mnt/c/DRWSL/project/vendor/phpstan/phpstan/phpstan/src/Analyser/MutatingScope.php on line 407
         Run PHPStan with --debug option and post the stack trace to:
         https://github.com/phpstan/phpstan/issues/new
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------

Code snippet that reproduces the problem

Whenever a number is parsed by symfony that is bigger that PHP_INT_MAX it is converted to a string. We want to know when that happens, using the following snippet:

is_string($attribute) && $attribute > PHP_INT_MAX

I am unable to create a reproduction on phpstan.org.

Expected output

No Internal error.

Stack trace

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to PHPStan\Type\IntegerRangeType::fromInterval() must be of the type integer or null, float given, called in phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Analy
ser/MutatingScope.php on line 407 and defined in phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Type/IntegerRangeType.php:20
Stack trace:
#0 phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Analyser/MutatingScope.php(407): PHPStan\Type\IntegerRangeType::fromInterval(9.2233720368548E+18, NULL)
#1 phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Analyser/MutatingScope.php(382): PHPStan\Analyser\MutatingScope->resolveType(Object(PhpParser\Node\Expr\BinaryOp\Greater))
#2 phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Analyser/MutatingScope.php(509): PHPStan\Analyser\MutatingScope->getType(Object(PhpParser\Node\Expr\BinaryOp\Greater))
#3 phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Analyser/MutatingScope.php(382): PHPStan\Analyser\M in phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Type/IntegerRangeType.php on line 20

Fatal error: Uncaught TypeError: Argument 1 passed to PHPStan\Type\IntegerRangeType::fromInterval() must be of the type integer or null, float given, called in phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Analyser/M
utatingScope.php on line 407 and defined in phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Type/IntegerRangeType.php:20
Stack trace:
#0 phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Analyser/MutatingScope.php(407): PHPStan\Type\IntegerRangeType::fromInterval(9.2233720368548E+18, NULL)
#1 phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Analyser/MutatingScope.php(382): PHPStan\Analyser\MutatingScope->resolveType(Object(PhpParser\Node\Expr\BinaryOp\Greater))
#2 phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Analyser/MutatingScope.php(509): PHPStan\Analyser\MutatingScope->getType(Object(PhpParser\Node\Expr\BinaryOp\Greater))
#3 phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Analyser/MutatingScope.php(382): PHPStan\Analyser\M in phar:///mnt/c/WSL/project/vendor/phpstan/phpstan/phpstan/src/Type/IntegerRangeType.php on line 20

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions