Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
crissi opened this issue Sep 22, 2020 · 2 comments
Labels
Milestone

Comments

@crissi
Copy link

crissi commented Sep 22, 2020

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) {

@ondrejmirtes
Copy link
Member

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Sep 22, 2020
jlherren added a commit to jlherren/phpstan-src that referenced this issue Nov 11, 2020
jlherren added a commit to jlherren/phpstan-src that referenced this issue Nov 12, 2020
jlherren added a commit to jlherren/phpstan-src that referenced this issue Nov 12, 2020
@github-actions
Copy link

github-actions bot commented May 8, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants