Skip to content

Internal error: Argument 1 passed to PHPStan\Type\IntegerRangeType::fromInterval() must be of the type int or null, float given, called in  #3880

@crissi

Description

@crissi

Internal error: Argument 1 passed to
PHPStan\Type\IntegerRangeType::fromInterval() must be of the type int
or null, float given, called in
phar:///var/www/ordrestyring-api/vendor/phpstan/phpstan/phpstan/src/A
nalyser/MutatingScope.php on line 375
Run PHPStan with --debug option and post the stack trace to:
https://github.com/phpstan/phpstan/issues/new

Code
$num = (float) $value;
if ((!is_numeric($value) && !is_bool($value)) || $num > 9223372036854775807 || $num < -9223372036854775808) {
// throw
}

Trace
TypeError

Argument 1 passed to PHPStan\Type\IntegerRangeType::fromInterval() must be of the type int or null, float given, called in phar:///var/www/ordrestyring-api/vendor/phpstan/phpstan/phpstan/src/Analyser/MutatingScope.php on line 375

at phar://vendor/phpstan/phpstan/phpstan/src/Type/IntegerRangeType.php:20
16| \assert($min === null || $max === null || $min <= $max);
17| $this->min = $min ?? \PHP_INT_MIN;
18| $this->max = $max ?? \PHP_INT_MAX;
19| }

20| public static function fromInterval(?int $min, ?int $max) : \PHPStan\Type\Type
21| {
22| $min = $min ?? \PHP_INT_MIN;
23| $max = $max ?? \PHP_INT_MAX;
24| if ($min > $max) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions