Skip to content

Commit 1106d65

Browse files
committed
Merge branch 'php-8.0/psr12-booleanoperatorplacement-support-match' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents b27f086 + ab7af46 commit 1106d65

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

src/Standards/PSR12/Sniffs/ControlStructures/BooleanOperatorPlacementSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function register()
3737
T_WHILE,
3838
T_SWITCH,
3939
T_ELSEIF,
40+
T_MATCH,
4041
];
4142

4243
}//end register()

src/Standards/PSR12/Tests/ControlStructures/BooleanOperatorPlacementUnitTest.inc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,14 @@ if (
118118
) {
119119
return 5;
120120
}
121+
122+
// Reset to default.
123+
// phpcs:set PSR12.ControlStructures.BooleanOperatorPlacement allowOnly
124+
125+
match (
126+
$expr1
127+
&& $expr2 &&
128+
$expr3
129+
) {
130+
// structure body
131+
};

src/Standards/PSR12/Tests/ControlStructures/BooleanOperatorPlacementUnitTest.inc.fixed

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,14 @@ if (
128128
) {
129129
return 5;
130130
}
131+
132+
// Reset to default.
133+
// phpcs:set PSR12.ControlStructures.BooleanOperatorPlacement allowOnly
134+
135+
match (
136+
$expr1
137+
&& $expr2
138+
&& $expr3
139+
) {
140+
// structure body
141+
};

src/Standards/PSR12/Tests/ControlStructures/BooleanOperatorPlacementUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function getErrorList()
3535
90 => 1,
3636
98 => 1,
3737
104 => 1,
38+
125 => 1,
3839
];
3940

4041
}//end getErrorList()

0 commit comments

Comments
 (0)