@@ -5647,6 +5647,12 @@ static function (): void {
56475647 TypeCombinator::intersect ($ assignedExprType ->toCoercedArgumentType (true ), $ propertyNativeType ),
56485648 TypeCombinator::intersect ($ assignedNativeType ->toCoercedArgumentType (true ), $ propertyNativeType ),
56495649 );
5650+ } elseif (TypeCombinator::containsNull ($ propertyNativeType ) && !TypeCombinator::containsNull ($ assignedNativeType )) {
5651+ $ scope = $ scope ->assignExpression (
5652+ $ var ,
5653+ TypeCombinator::removeNull ($ propertyReflection ->hasPhpDocType () ? $ propertyReflection ->getPhpDocType () : $ propertyNativeType ),
5654+ TypeCombinator::removeNull ($ propertyNativeType ),
5655+ );
56505656 }
56515657 } else {
56525658 $ scope = $ scope ->assignExpression ($ var , $ assignedExprType , $ scope ->getNativeType ($ assignedExpr ));
@@ -5735,6 +5741,12 @@ static function (): void {
57355741 TypeCombinator::intersect ($ assignedExprType ->toCoercedArgumentType (true ), $ propertyNativeType ),
57365742 TypeCombinator::intersect ($ assignedNativeType ->toCoercedArgumentType (true ), $ propertyNativeType ),
57375743 );
5744+ } elseif (TypeCombinator::containsNull ($ propertyNativeType ) && !TypeCombinator::containsNull ($ assignedNativeType )) {
5745+ $ scope = $ scope ->assignExpression (
5746+ $ var ,
5747+ TypeCombinator::removeNull ($ propertyReflection ->hasPhpDocType () ? $ propertyReflection ->getPhpDocType () : $ propertyNativeType ),
5748+ TypeCombinator::removeNull ($ propertyNativeType ),
5749+ );
57385750 }
57395751 } else {
57405752 $ scope = $ scope ->assignExpression ($ var , $ assignedExprType , $ scope ->getNativeType ($ assignedExpr ));
0 commit comments