Skip to content

Commit

Permalink
ComparisonOperatorUsage: add test with anonymous class
Browse files Browse the repository at this point in the history
.. to document that the sniff also handles comparisons passed in the instantiation of an anonymous class.
  • Loading branch information
jrfnl committed Nov 11, 2023
1 parent 7027990 commit 520b5c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,10 @@ if (empty($argTags > 0)) {
}

myFunction($var1 === true ? "" : "foobar");

$anon = new class(!$foo ? 0 : 1, ($bar == true) ? 1 : 0) {
function __construct($a, $b) {}
};
$anon = new class($foo === false ? 0 : 1, ($bar === true) ? 1 : 0) {
function __construct($a, $b) {}
};
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function getErrorList()
127 => 1,
131 => 1,
135 => 1,
140 => 2,
];

}//end getErrorList()
Expand Down

0 comments on commit 520b5c1

Please sign in to comment.