@@ -5629,13 +5629,13 @@ static function (): void {
56295629 $ propertyNativeType = $ propertyReflection ->getNativeType ();
56305630
56315631 if ($ propertyReflection ->hasNativeType ()) {
5632- if ($ propertyNativeType ->isNull ()->no ()) {
5632+ if ($ scope ->isDeclareStrictTypes ()) {
5633+ $ scope = $ scope ->assignExpression ($ var , TypeCombinator::intersect ($ assignedExprType ->toCoercedArgumentType (true ), $ propertyNativeType ), TypeCombinator::intersect ($ assignedNativeType ->toCoercedArgumentType (true ), $ propertyNativeType ));
5634+ } elseif ($ propertyNativeType ->isNull ()->no ()) {
56335635 $ assignedExprType = TypeCombinator::removeNull ($ assignedExprType );
56345636 $ assignedNativeType = TypeCombinator::removeNull ($ assignedNativeType );
5635- }
56365637
5637- if ($ scope ->isDeclareStrictTypes ()) {
5638- $ scope = $ scope ->assignExpression ($ var , TypeCombinator::intersect ($ assignedExprType ->toCoercedArgumentType (true ), $ propertyNativeType ), TypeCombinator::intersect ($ assignedNativeType ->toCoercedArgumentType (true ), $ propertyNativeType ));
5638+ $ scope = $ scope ->assignExpression ($ var , $ assignedExprType , $ assignedNativeType );
56395639 } else {
56405640 $ scope = $ scope ->assignExpression ($ var , $ assignedExprType , $ assignedNativeType );
56415641 }
@@ -5710,13 +5710,13 @@ static function (): void {
57105710 $ propertyNativeType = $ propertyReflection ->getNativeType ();
57115711
57125712 if ($ propertyReflection ->hasNativeType ()) {
5713- if ($ propertyNativeType ->isNull ()->no ()) {
5713+ if ($ scope ->isDeclareStrictTypes ()) {
5714+ $ scope = $ scope ->assignExpression ($ var , TypeCombinator::intersect ($ assignedExprType ->toCoercedArgumentType (true ), $ propertyNativeType ), TypeCombinator::intersect ($ assignedNativeType ->toCoercedArgumentType (true ), $ propertyNativeType ));
5715+ } elseif ($ propertyNativeType ->isNull ()->no ()) {
57145716 $ assignedExprType = TypeCombinator::removeNull ($ assignedExprType );
57155717 $ assignedNativeType = TypeCombinator::removeNull ($ assignedNativeType );
5716- }
57175718
5718- if ($ scope ->isDeclareStrictTypes ()) {
5719- $ scope = $ scope ->assignExpression ($ var , TypeCombinator::intersect ($ assignedExprType ->toCoercedArgumentType (true ), $ propertyNativeType ), TypeCombinator::intersect ($ assignedNativeType ->toCoercedArgumentType (true ), $ propertyNativeType ));
5719+ $ scope = $ scope ->assignExpression ($ var , $ assignedExprType , $ assignedNativeType );
57205720 } else {
57215721 $ scope = $ scope ->assignExpression ($ var , $ assignedExprType , $ assignedNativeType );
57225722 }
0 commit comments