Skip to content

Commit efecc10

Browse files
committed
Fix CI failures [claude-ci-fix]
Automated fix attempt 1 for CI failures.
1 parent 45c195a commit efecc10

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
use PHPStan\Type\Constant\ConstantIntegerType;
175175
use PHPStan\Type\Constant\ConstantStringType;
176176
use PHPStan\Type\FileTypeMapper;
177+
use PHPStan\Type\FloatType;
177178
use PHPStan\Type\GeneralizePrecision;
178179
use PHPStan\Type\Generic\TemplateTypeHelper;
179180
use PHPStan\Type\Generic\TemplateTypeMap;
@@ -6367,13 +6368,12 @@ private function processAssignVar(
63676368
if ($declaringClass->hasNativeProperty($propertyName)) {
63686369
$nativeProperty = $declaringClass->getNativeProperty($propertyName);
63696370
$propertyNativeType = $nativeProperty->getNativeType();
6370-
$assignedNativeType = $scope->getNativeType($assignedExpr);
6371-
// Widen property type to accept int for float properties (PHP allows int-to-float coercion)
6372-
$propertyNativeTypeForCheck = !$propertyNativeType->isFloat()->no()
6371+
// Widen property type to accept int for float properties (PHP allows int-to-float coercion without TypeError)
6372+
$propertyNativeTypeForAccepts = $propertyNativeType->isSuperTypeOf(new FloatType())->yes()
63736373
? TypeCombinator::union($propertyNativeType, new IntegerType())
63746374
: $propertyNativeType;
63756375
if (
6376-
!$propertyNativeTypeForCheck->isSuperTypeOf($assignedNativeType)->yes()
6376+
!$propertyNativeTypeForAccepts->isSuperTypeOf($assignedExprType)->yes()
63776377
) {
63786378
$throwPoints[] = InternalThrowPoint::createExplicit($scope, new ObjectType(TypeError::class), $assignedExpr, false);
63796379
}

0 commit comments

Comments
 (0)