Skip to content

Commit 43313f3

Browse files
committed
Fixed bug #19727 : PSR2: no error reported when using } elseif {
1 parent 2fc7017 commit 43313f3

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

CodeSniffer/Standards/Squiz/Sniffs/ControlStructures/ControlSignatureSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ protected function getPatterns()
5858
'if (...) {EOL',
5959
'foreach (...) {EOL',
6060
'} else if (...) {EOL',
61+
'} elseif (...) {EOL',
6162
'} else {EOL',
6263
);
6364

CodeSniffer/Standards/Squiz/Tests/ControlStructures/ControlSignatureUnitTest.inc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,10 @@ try { $code = 'this'; } catch (Exception $e) {
152152
do { echo $i;
153153
} while ($i > 0);
154154

155-
?>
155+
if ($a) {
156+
157+
}
158+
elseif ($b) {
159+
160+
}
161+
?>

CodeSniffer/Standards/Squiz/Tests/ControlStructures/ControlSignatureUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function getErrorList($testFile='ControlSignatureUnitTest.inc')
7272
139 => 1,
7373
148 => 1,
7474
152 => 1,
75+
158 => 1,
7576
);
7677
break;
7778
case 'ControlSignatureUnitTest.js':

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
3838
-- Thanks to Andy Grunwald for the patch
3939
- Fixed bug #19699 : Generic.Files.LineLength giving false positives when tab-width is used
4040
- Fixed bug #19726 : Wrong number of spaces expected after instanceof static
41+
- Fixed bug #19727 : PSR2: no error reported when using } elseif {
4142
</notes>
4243
<contents>
4344
<dir name="/">

0 commit comments

Comments
 (0)