File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
src/main/QafooLabs/Refactoring/Adapters/PHPParser/Visitor Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -59,10 +59,15 @@ private function enterAssignment(Node\Expr\Assign $node)
5959 $ this ->assignments [$ node ->var ->name ][] = $ node ->getLine ();
6060 $ this ->seenAssignmentVariables ->attach ($ node ->var );
6161 } else if ($ node ->var instanceof Node \Expr \ArrayDimFetch) {
62+ // unfold $array[$var][$var]
63+ $ var = $ node ->var ->var ;
64+ while (!isset ($ var ->name )) {
65+ $ var = $ var ->var ;
66+ }
6267 // $foo[] = "baz" is both a read and a write access to $foo
63- $ this ->localVariables [$ node -> var -> var ->name ][] = $ node ->getLine ();
64- $ this ->assignments [$ node -> var -> var ->name ][] = $ node ->getLine ();
65- $ this ->seenAssignmentVariables ->attach ($ node -> var -> var );
68+ $ this ->localVariables [$ var ->name ][] = $ node ->getLine ();
69+ $ this ->assignments [$ var ->name ][] = $ node ->getLine ();
70+ $ this ->seenAssignmentVariables ->attach ($ var );
6671 }
6772 }
6873
You can’t perform that action at this time.
0 commit comments