Skip to content

Commit 7f61ecb

Browse files
committed
Add unit test to demonstrate Notice and false "ERROR | CASE statements must not be defined using curly braces"
1 parent ee4a20e commit 7f61ecb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

CodeSniffer/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.inc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,18 @@ switch ($foo) {
7373
case Foo::TWO:
7474
break;
7575
}
76+
77+
switch (true) {
78+
case $value instanceof StdClass:
79+
return 1;
80+
case strpos('_', get_class($value)) !== false:
81+
break;
82+
}
83+
84+
switch (true) {
85+
case $value instanceof StdClass:
86+
if ($value) {
87+
return null;
88+
}
89+
}
7690
?>

0 commit comments

Comments
 (0)