Skip to content

Commit 19cb50e

Browse files
authored
[Documentation] Squiz: Scope Closing Brace (#353)
* Docs: add documentation for Squiz.WhiteSpace.ScopeClosingBrace * Docs: improve documentation for Squiz.WhiteSpace.ScopeClosingBrace - Fixup CDATA indentation - Improve wording in code examples - Add more varied code examples * Docs: clarify wording and code samples for Squiz.WhiteSpace.ScopeClosingBrace * Docs: combine code examples in Squiz.WhiteSpace.ScopeClosingBrace Better illustrates that statements can be indented, and that their closing braces still should align with the start of the statement. * Docs: improve examples for Squiz.WhiteSpace.ScopeClosingBrace - Reduces wordiness - Adds an example of too little whitespace * Docs: add missing emphasis in Squiz.WhiteSpace.ScopeClosingBrace * Docs: improve code examples for Squiz.WhiteSpace.ScopeClosingBrace - Combine too little with too much whitespace - Adjust emphasis on example containing PHP tags - Change example paragraph to span for better HTML formatting
1 parent 36d019c commit 19cb50e

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<documentation title="Scope Closing Brace">
2+
<standard>
3+
<![CDATA[
4+
Indentation of a closing brace must match the indentation of the line containing the opening brace.
5+
]]>
6+
</standard>
7+
<code_comparison>
8+
<code title="Valid: Closing brace aligned with line containing opening brace.">
9+
<![CDATA[
10+
function foo()
11+
{
12+
<em>}</em>
13+
14+
if (!class_exists('Foo')) {
15+
class Foo {
16+
<em>}</em>
17+
<em>}</em>
18+
19+
<?php if ($something) { ?>
20+
<span>some output</span>
21+
<em><?php }</em> ?>
22+
]]>
23+
</code>
24+
<code title="Invalid: Closing brace misaligned with line containing opening brace.">
25+
<![CDATA[
26+
function foo()
27+
{
28+
<em> }</em>
29+
30+
if (!class_exists('Foo')) {
31+
class Foo {
32+
<em>}</em>
33+
<em> }</em>
34+
35+
<?php if ($something) { ?>
36+
<span>some output</span>
37+
<em> <?php }</em> ?>
38+
]]>
39+
</code>
40+
</code_comparison>
41+
<standard>
42+
<![CDATA[
43+
Closing brace must be on a line by itself.
44+
]]>
45+
</standard>
46+
<code_comparison>
47+
<code title="Valid: Close brace on its own line.">
48+
<![CDATA[
49+
enum Foo {
50+
<em>}</em>
51+
]]>
52+
</code>
53+
<code title="Invalid: Close brace on a line containing other code.">
54+
<![CDATA[
55+
enum Foo {<em>}</em>
56+
]]>
57+
</code>
58+
</code_comparison>
59+
</documentation>

0 commit comments

Comments
 (0)