@@ -2567,7 +2567,10 @@ public function isUndefinedExpressionAllowed(Expr $expr): bool
25672567 return array_key_exists ($ exprString , $ this ->currentlyAllowedUndefinedExpressions );
25682568 }
25692569
2570- public function assignVariable (string $ variableName , Type $ type , Type $ nativeType , TrinaryLogic $ certainty ): self
2570+ /**
2571+ * @param list<string> $intertwinedPropagatedFrom
2572+ */
2573+ public function assignVariable (string $ variableName , Type $ type , Type $ nativeType , TrinaryLogic $ certainty , array $ intertwinedPropagatedFrom = []): self
25712574 {
25722575 $ node = new Variable ($ variableName );
25732576 $ scope = $ this ->assignExpression ($ node , $ type , $ nativeType );
@@ -2596,11 +2599,16 @@ public function assignVariable(string $variableName, Type $type, Type $nativeTyp
25962599 && is_string ($ expressionType ->getExpr ()->getExpr ()->name )
25972600 && !$ has ->no ()
25982601 ) {
2602+ $ targetVarName = $ expressionType ->getExpr ()->getExpr ()->name ;
2603+ if (in_array ($ targetVarName , $ intertwinedPropagatedFrom , true )) {
2604+ continue ;
2605+ }
25992606 $ scope = $ scope ->assignVariable (
2600- $ expressionType -> getExpr ()-> getExpr ()-> name ,
2607+ $ targetVarName ,
26012608 $ scope ->getType ($ expressionType ->getExpr ()->getAssignedExpr ()),
26022609 $ scope ->getNativeType ($ expressionType ->getExpr ()->getAssignedExpr ()),
26032610 $ has ,
2611+ array_merge ($ intertwinedPropagatedFrom , [$ variableName ]),
26042612 );
26052613 } else {
26062614 $ scope = $ scope ->assignExpression (
@@ -2825,6 +2833,12 @@ public function invalidateExpression(Expr $expressionToInvalidate, bool $require
28252833
28262834 foreach ($ expressionTypes as $ exprString => $ exprTypeHolder ) {
28272835 $ exprExpr = $ exprTypeHolder ->getExpr ();
2836+ if (
2837+ $ exprExpr instanceof IntertwinedVariableByReferenceWithExpr
2838+ && $ exprExpr ->isVariableToVariableReference ()
2839+ ) {
2840+ continue ;
2841+ }
28282842 if (!$ this ->shouldInvalidateExpression ($ exprStringToInvalidate , $ expressionToInvalidate , $ exprExpr , $ exprString , $ requireMoreCharacters , $ invalidatingClass )) {
28292843 continue ;
28302844 }
0 commit comments