Skip to content

Commit 675f260

Browse files
Fix for old php version
1 parent 3ff9877 commit 675f260

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Rules/Functions/ParameterCastableToNumberRule.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use PHPStan\Rules\ParameterCastableToStringCheck;
1212
use PHPStan\Rules\Rule;
1313
use PHPStan\Type\ErrorType;
14+
use PHPStan\Type\MixedType;
1415
use PHPStan\Type\Type;
1516
use function count;
1617
use function in_array;
@@ -69,7 +70,7 @@ public function processNode(Node $node, Scope $scope): array
6970

7071
$castFn = $this->phpVersion->supportsObjectsInArraySumProduct()
7172
? static fn (Type $t) => $t->toNumber()
72-
: static fn (Type $t) => !$t->isObject()->no() ? new ErrorType() : $t->toNumber();
73+
: static fn (Type $t) => !$t instanceof MixedType && !$t->isObject()->no() ? new ErrorType() : $t->toNumber();
7374

7475
$error = $this->parameterCastableToStringCheck->checkParameter(
7576
$origArgs[0],

0 commit comments

Comments
 (0)