@@ -2866,18 +2866,6 @@ public function invalidateExpression(Expr $expressionToInvalidate, bool $require
28662866
28672867 foreach ($ expressionTypes as $ exprString => $ exprTypeHolder ) {
28682868 $ exprExpr = $ exprTypeHolder ->getExpr ();
2869- if (
2870- $ exprExpr instanceof IntertwinedVariableByReferenceWithExpr
2871- && $ expressionToInvalidate instanceof Variable
2872- && is_string ($ expressionToInvalidate ->name )
2873- && (
2874- $ exprExpr ->getVariableName () === $ expressionToInvalidate ->name
2875- || $ this ->getIntertwinedRefRootVariableName ($ exprExpr ->getExpr ()) === $ expressionToInvalidate ->name
2876- || $ this ->getIntertwinedRefRootVariableName ($ exprExpr ->getAssignedExpr ()) === $ expressionToInvalidate ->name
2877- )
2878- ) {
2879- continue ;
2880- }
28812869 if (!$ this ->shouldInvalidateExpression ($ exprStringToInvalidate , $ expressionToInvalidate , $ exprExpr , $ exprString , $ requireMoreCharacters , $ invalidatingClass )) {
28822870 continue ;
28832871 }
@@ -2958,6 +2946,19 @@ private function getIntertwinedRefRootVariableName(Expr $expr): ?string
29582946
29592947 private function shouldInvalidateExpression (string $ exprStringToInvalidate , Expr $ exprToInvalidate , Expr $ expr , string $ exprString , bool $ requireMoreCharacters = false , ?ClassReflection $ invalidatingClass = null ): bool
29602948 {
2949+ if (
2950+ $ expr instanceof IntertwinedVariableByReferenceWithExpr
2951+ && $ exprToInvalidate instanceof Variable
2952+ && is_string ($ exprToInvalidate ->name )
2953+ && (
2954+ $ expr ->getVariableName () === $ exprToInvalidate ->name
2955+ || $ this ->getIntertwinedRefRootVariableName ($ expr ->getExpr ()) === $ exprToInvalidate ->name
2956+ || $ this ->getIntertwinedRefRootVariableName ($ expr ->getAssignedExpr ()) === $ exprToInvalidate ->name
2957+ )
2958+ ) {
2959+ return false ;
2960+ }
2961+
29612962 if ($ requireMoreCharacters && $ exprStringToInvalidate === $ exprString ) {
29622963 return false ;
29632964 }
0 commit comments