Skip to content

Commit a1795c1

Browse files
committed
Improve readability of the documentation
Added emphasis as per PR review and added additional standards so that the documentation is easier to read (split by logic as suggested in the PR review).
1 parent c62e10f commit a1795c1

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpacingStandard.xml

+24-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<documentation title="Control Structure Spacing">
22
<standard>
33
<![CDATA[
4-
Control structures MUST have correct spacing.
4+
The control structures must have one space after the control structure keyword, no spaces after the opening parenthesis and before the closing parenthesis, and one space between the closing parenthesis and the opening brace.
55
]]>
66
</standard>
77
<code_comparison>
@@ -32,46 +32,56 @@ if ($expr<em> </em>) {
3232
]]>
3333
</code>
3434
</code_comparison>
35+
<standard>
36+
<![CDATA[
37+
The body of the multi-line control structure must be indented once, placing the body on the next line after the opening brace.
38+
]]>
39+
</standard>
3540
<code_comparison>
36-
<code title="Valid: Each line in a multi-line control structure condition block indented at least once. Default indentation is 4 spaces.">
41+
<code title="Valid: First expression of a multi-line control structure condition block is on the line after the opening parenthesis.">
3742
<![CDATA[
3843
while (
39-
<em> </em>$expr1
40-
<em> </em>&& $expr2
44+
<em>$expr1</em>
45+
&& $expr2
4146
) {
4247
}
4348
]]>
4449
</code>
45-
<code title="Invalid: Some lines in a multi-line control structure condition block not indented correctly.">
50+
<code title="Invalid: First expression of a multi-line control structure condition block is on the same line as the opening parenthesis.">
4651
<![CDATA[
47-
while (
48-
<em></em>$expr1
52+
while (<em></em>$expr1
4953
&& $expr2
50-
<em> </em>&& $expr3
5154
) {
5255
}
5356
]]>
5457
</code>
5558
</code_comparison>
5659
<code_comparison>
57-
<code title="Valid: First expression of a multi-line control structure condition block is on the line after the opening parenthesis.">
60+
<code title="Valid: Each line in a multi-line control structure condition block indented at least once. Default indentation is 4 spaces.">
5861
<![CDATA[
5962
while (
60-
$expr1
61-
&& $expr2
63+
<em> </em>$expr1
64+
<em> </em>&& $expr2
6265
) {
6366
}
6467
]]>
6568
</code>
66-
<code title="Invalid: First expression of a multi-line control structure condition block is on the same line as the opening parenthesis.">
69+
<code title="Invalid: Some lines in a multi-line control structure condition block not indented correctly.">
6770
<![CDATA[
68-
while (<em></em>$expr1
71+
while (
72+
<em></em>$expr1
6973
&& $expr2
74+
<em> </em>&& $expr3
7075
) {
7176
}
7277
]]>
7378
</code>
7479
</code_comparison>
80+
<standard>
81+
<![CDATA[
82+
The closing parenthesis of the multi-line control structure must be on the next line after the body, indented to the same level as the start of the control structure.
83+
]]>
84+
</standard>
7585
<code_comparison>
7686
<code title="Valid: The closing parenthesis of a multi-line control structure condition block is on the line after the last expression.">
7787
<![CDATA[
@@ -97,7 +107,7 @@ while (
97107
while (
98108
$expr1
99109
&& $expr2
100-
) {
110+
<em>)</em> {
101111
}
102112
]]>
103113
</code>

0 commit comments

Comments
 (0)