@@ -5392,6 +5392,7 @@ private function processAssignVar(
53925392 }
53935393 }
53945394
5395+ $ scopeBeforeAssignEval = $ scope ;
53955396 $ scope = $ result ->getScope ();
53965397 $ truthySpecifiedTypes = $ this ->typeSpecifier ->specifyTypesInCondition ($ scope , $ assignedExpr , TypeSpecifierContext::createTruthy ());
53975398 $ falseySpecifiedTypes = $ this ->typeSpecifier ->specifyTypesInCondition ($ scope , $ assignedExpr , TypeSpecifierContext::createFalsey ());
@@ -5404,7 +5405,7 @@ private function processAssignVar(
54045405 $ conditionalExpressions = $ this ->processSureTypesForConditionalExpressionsAfterAssign ($ scope , $ var ->name , $ conditionalExpressions , $ falseySpecifiedTypes , $ falseyType );
54055406 $ conditionalExpressions = $ this ->processSureNotTypesForConditionalExpressionsAfterAssign ($ scope , $ var ->name , $ conditionalExpressions , $ falseySpecifiedTypes , $ falseyType );
54065407
5407- $ nodeCallback (new VariableAssignNode ($ var , $ assignedExpr ), $ result -> getScope () );
5408+ $ nodeCallback (new VariableAssignNode ($ var , $ assignedExpr ), $ scopeBeforeAssignEval );
54085409 $ scope = $ scope ->assignVariable ($ var ->name , $ type , $ scope ->getNativeType ($ assignedExpr ), TrinaryLogic::createYes ());
54095410 foreach ($ conditionalExpressions as $ exprString => $ holders ) {
54105411 $ scope = $ scope ->addConditionalExpressions ($ exprString , $ holders );
@@ -5575,9 +5576,9 @@ private function processAssignVar(
55755576 }
55765577 } else {
55775578 if ($ var instanceof Variable) {
5578- $ nodeCallback (new VariableAssignNode ($ var , $ assignedPropertyExpr ), $ scope );
5579+ $ nodeCallback (new VariableAssignNode ($ var , $ assignedPropertyExpr ), $ scopeBeforeAssignEval );
55795580 } elseif ($ var instanceof PropertyFetch || $ var instanceof StaticPropertyFetch) {
5580- $ nodeCallback (new PropertyAssignNode ($ var , $ assignedPropertyExpr , $ isAssignOp ), $ scope );
5581+ $ nodeCallback (new PropertyAssignNode ($ var , $ assignedPropertyExpr , $ isAssignOp ), $ scopeBeforeAssignEval );
55815582 if ($ var instanceof PropertyFetch && $ var ->name instanceof Node \Identifier && !$ isAssignOp ) {
55825583 $ scope = $ scope ->assignInitializedProperty ($ scope ->getType ($ var ->var ), $ var ->name ->toString ());
55835584 }
0 commit comments