Skip to content

Commit a2ca0b8

Browse files
jaymcpjrfnl
authored andcommitted
Docs: improve documentation for Squiz.WhiteSpace.ScopeClosingBrace
- Fixup CDATA indentation - Improve wording in code examples - Add more varied code examples
1 parent 87f1d4d commit a2ca0b8

File tree

1 file changed

+53
-19
lines changed

1 file changed

+53
-19
lines changed
Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,63 @@
11
<documentation title="Scope Closing Brace">
22
<standard>
33
<![CDATA[
4-
Closing brace indentation must match opening brace.
4+
Indentation of a closing brace must match the indentation of the line containing the opening brace.
55
]]>
66
</standard>
77
<code_comparison>
8-
<code title="Valid: Closing brace indented correctly.">
8+
<code title="Valid: Closing brace aligned with opening brace.">
99
<![CDATA[
1010
function foo()
11-
<em>{</em>
12-
echo 'hi';
13-
}
14-
]]>
11+
{
12+
echo 'opening brace at column 1';
13+
echo 'closing brace at column 1';
14+
<em>}</em>
15+
]]>
1516
</code>
16-
<code title="Invalid: Closing brace indented incorrectly.">
17+
<code title="Invalid: Closing brace misaligned with opening brace.">
1718
<![CDATA[
1819
function foo()
1920
{
20-
echo 'hi';
21+
echo 'opening brace at column 1';
22+
echo 'closing brace at column 2';
2123
<em> }</em>
22-
]]>
24+
]]>
25+
</code>
26+
</code_comparison>
27+
<code_comparison>
28+
<code title="Valid: Closing brace aligned with class keyword.">
29+
<![CDATA[
30+
class Foo {
31+
echo 'class keyword starts at column 1';
32+
echo 'closing brace at column 1';
33+
<em>}</em>
34+
]]>
35+
</code>
36+
<code title="Invalid: Closing brace misaligned with class keyword.">
37+
<![CDATA[
38+
class Foo {
39+
echo 'class keyword starts at column 1';
40+
echo 'closing brace at column 2';
41+
<em> }</em>
42+
]]>
43+
</code>
44+
</code_comparison>
45+
<code_comparison>
46+
<code title="Valid: Closing brace aligned with if keyword.">
47+
<![CDATA[
48+
if ($a > $b) {
49+
echo 'conditional starts at column 1';
50+
echo 'closing brace at column 1';
51+
<em>}</em>
52+
]]>
53+
</code>
54+
<code title="Invalid: Closing brace aligned with content.">
55+
<![CDATA[
56+
if ($a > $b) {
57+
echo 'conditional starts at column 1';
58+
echo 'closing brace at column 5';
59+
<em> }</em>
60+
]]>
2361
</code>
2462
</code_comparison>
2563
<standard>
@@ -28,20 +66,16 @@ function foo()
2866
]]>
2967
</standard>
3068
<code_comparison>
31-
<code title="Valid: Closing brace is on a line by itself.">
69+
<code title="Valid: Newline before closing brace.">
3270
<![CDATA[
33-
function foo()
34-
{
35-
echo 'hi';
71+
enum Foo {
3672
<em>}</em>
37-
]]>
73+
]]>
3874
</code>
39-
<code title="Invalid: Closing brace is alongside other content.">
75+
<code title="Invalid: No newline before closing brace.">
4076
<![CDATA[
41-
function foo()
42-
{
43-
echo 'hi';<em>}</em>
44-
]]>
77+
enum Foo {<em>}</em>
78+
]]>
4579
</code>
4680
</code_comparison>
4781
</documentation>

0 commit comments

Comments
 (0)