Skip to content

Commit 4d1b094

Browse files
committed
Update NodeScopeResolver.php
1 parent 7612714 commit 4d1b094

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5630,7 +5630,7 @@ static function (): void {
56305630

56315631
if ($propertyReflection->hasNativeType() && $scope->isDeclareStrictTypes()) {
56325632
$scope = $scope->assignExpression($var, TypeCombinator::intersect($assignedExprType->toCoercedArgumentType(true), $propertyNativeType), TypeCombinator::intersect($assignedNativeType->toCoercedArgumentType(true), $propertyNativeType));
5633-
} elseif ($propertyNativeType->isNull()->no()) {
5633+
} elseif ($propertyReflection->hasNativeType() && $propertyNativeType->isNull()->no()) {
56345634
$scope = $scope->assignExpression($var, TypeCombinator::removeNull($assignedExprType), TypeCombinator::removeNull($assignedNativeType));
56355635
} else {
56365636
$scope = $scope->assignExpression($var, $assignedExprType, $assignedNativeType);
@@ -5704,7 +5704,7 @@ static function (): void {
57045704

57055705
if ($propertyReflection->hasNativeType() && $scope->isDeclareStrictTypes()) {
57065706
$scope = $scope->assignExpression($var, TypeCombinator::intersect($assignedExprType->toCoercedArgumentType(true), $propertyNativeType), TypeCombinator::intersect($assignedNativeType->toCoercedArgumentType(true), $propertyNativeType));
5707-
} elseif ($propertyNativeType->isNull()->no()) {
5707+
} elseif ($propertyReflection->hasNativeType() && $propertyNativeType->isNull()->no()) {
57085708
$scope = $scope->assignExpression($var, TypeCombinator::removeNull($assignedExprType), TypeCombinator::removeNull($assignedNativeType));
57095709
} else {
57105710
$scope = $scope->assignExpression($var, $assignedExprType, $assignedNativeType);

0 commit comments

Comments
 (0)