@@ -5629,13 +5629,13 @@ static function (): void {
5629
5629
$ propertyNativeType = $ propertyReflection ->getNativeType ();
5630
5630
5631
5631
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 ()) {
5633
5635
$ assignedExprType = TypeCombinator::removeNull ($ assignedExprType );
5634
5636
$ assignedNativeType = TypeCombinator::removeNull ($ assignedNativeType );
5635
- }
5636
5637
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 );
5639
5639
} else {
5640
5640
$ scope = $ scope ->assignExpression ($ var , $ assignedExprType , $ assignedNativeType );
5641
5641
}
@@ -5710,13 +5710,13 @@ static function (): void {
5710
5710
$ propertyNativeType = $ propertyReflection ->getNativeType ();
5711
5711
5712
5712
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 ()) {
5714
5716
$ assignedExprType = TypeCombinator::removeNull ($ assignedExprType );
5715
5717
$ assignedNativeType = TypeCombinator::removeNull ($ assignedNativeType );
5716
- }
5717
5718
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 );
5720
5720
} else {
5721
5721
$ scope = $ scope ->assignExpression ($ var , $ assignedExprType , $ assignedNativeType );
5722
5722
}
0 commit comments