You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Documentation title should match the sniff name.
- Use different `<standard>` blocks for each error triggered by the
sniff.
- Minor changes to the text to make it more clear and consistent.
Copy file name to clipboardExpand all lines: src/Standards/PSR2/Docs/ControlStructures/SwitchDeclarationStandard.xml
+24-9Lines changed: 24 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,19 @@
1
-
<documentationtitle="Switch Declarations">
1
+
<documentationtitle="Switch Declaration">
2
2
<standard>
3
3
<![CDATA[
4
-
Case statements should be followed by a space. Colons in switch declarations should not be preceded by whitespace. Break statements should be indented 4 more spaces from the case statement. There must be a comment when falling through from one case into the next.
4
+
Case statements must be followed by exactly one space.
5
5
]]>
6
6
</standard>
7
7
<code_comparison>
8
-
<codetitle="Valid: Case statement followed by 1 space.">
8
+
<codetitle="Valid: Case statement followed by one space.">
9
9
<![CDATA[
10
10
switch ($foo) {
11
11
case<em> </em>'bar':
12
12
break;
13
13
}
14
14
]]>
15
15
</code>
16
-
<codetitle="Invalid: Case statement not followed by 1 space.">
16
+
<codetitle="Invalid: Case statement not followed by one space.">
17
17
<![CDATA[
18
18
switch ($foo) {
19
19
case<em></em>'bar':
@@ -22,8 +22,13 @@ switch ($foo) {
22
22
]]>
23
23
</code>
24
24
</code_comparison>
25
+
<standard>
26
+
<![CDATA[
27
+
There must be no whitespace between the case value or default keyword and the colon.
28
+
]]>
29
+
</standard>
25
30
<code_comparison>
26
-
<codetitle="Valid: Colons not prefixed by whitespace.">
31
+
<codetitle="Valid: Colons not preceded by whitespace.">
27
32
<![CDATA[
28
33
switch ($foo) {
29
34
case 'bar'<em></em>:
@@ -33,7 +38,7 @@ switch ($foo) {
33
38
}
34
39
]]>
35
40
</code>
36
-
<codetitle="Invalid: Colons prefixed by whitespace.">
41
+
<codetitle="Invalid: Colons preceded by whitespace.">
37
42
<![CDATA[
38
43
switch ($foo) {
39
44
case 'bar'<em> </em>:
@@ -44,6 +49,11 @@ switch ($foo) {
44
49
]]>
45
50
</code>
46
51
</code_comparison>
52
+
<standard>
53
+
<![CDATA[
54
+
Terminating statements must be indented four more spaces from the case statement.
0 commit comments