Skip to content

Commit

Permalink
PHP 8.0 | PSR12/BooleanOperatorPlacement: include match expressions
Browse files Browse the repository at this point in the history
Allows the sniff to also check the placement of boolean operators in match expressions.

Includes unit test.
  • Loading branch information
jrfnl committed Feb 23, 2021
1 parent b52a018 commit ab7af46
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function register()
T_WHILE,
T_SWITCH,
T_ELSEIF,
T_MATCH,
];

}//end register()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,14 @@ if (
) {
return 5;
}

// Reset to default.
// phpcs:set PSR12.ControlStructures.BooleanOperatorPlacement allowOnly

match (
$expr1
&& $expr2 &&
$expr3
) {
// structure body
};
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,14 @@ if (
) {
return 5;
}

// Reset to default.
// phpcs:set PSR12.ControlStructures.BooleanOperatorPlacement allowOnly

match (
$expr1
&& $expr2
&& $expr3
) {
// structure body
};
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function getErrorList()
90 => 1,
98 => 1,
104 => 1,
125 => 1,
];

}//end getErrorList()
Expand Down

0 comments on commit ab7af46

Please sign in to comment.