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 Dec 7, 2023
1 parent a949e13 commit 659c6bf
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 659c6bf

Please sign in to comment.