Skip to content

Commit

Permalink
Generic/CallTimePassByReference: support anonymous classes
Browse files Browse the repository at this point in the history
This commit changes the sniff to flag call-time pass-by-reference
arguments when instantiating an anonymous class.
  • Loading branch information
rodrigoprimo authored and jrfnl committed Apr 22, 2024
1 parent 7030f03 commit b91a18b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function register()
return [
T_STRING,
T_VARIABLE,
T_ANON_CLASS,
];

}//end register()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ $instance = new $var($a);
$instance = new MyClass($a);
$instance = new $var(&$a);
$instance = new MyClass(&$a);

$anon = new class($a) {};
$anon = new class(&$a) {};
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function getErrorList($testFile='CallTimePassByReferenceUnitTest.1.inc')
41 => 1,
50 => 1,
51 => 1,
54 => 1,
];

default:
Expand Down

0 comments on commit b91a18b

Please sign in to comment.