Skip to content

Commit d3e4068

Browse files
committed
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.
1 parent 9cd4fd2 commit d3e4068

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

src/Standards/Squiz/Docs/WhiteSpace/ScopeClosingBraceStandard.xml

+9-19
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,17 @@
55
]]>
66
</standard>
77
<code_comparison>
8-
<code title="Valid: Closing brace aligned with opening brace.">
8+
<code title="Valid: Closing brace aligned with line containing opening brace.">
99
<![CDATA[
1010
function foo()
1111
{
1212
echo 'opening brace at column 1';
1313
echo 'closing brace at column 1';
1414
<em>}</em>
1515
16-
class Foo {
17-
echo 'class keyword starts at column 1';
18-
echo 'closing brace at column 1';
19-
<em>}</em>
20-
21-
if ($a > $b) {
22-
echo 'conditional starts at column 1';
23-
echo 'closing brace at column 1';
16+
if (!class_exists('Foo')) {
17+
class Foo {
18+
<em>}</em>
2419
<em>}</em>
2520
2621
<?php if ($something) { ?>
@@ -29,23 +24,18 @@ if ($a > $b) {
2924
<?php } ?>
3025
]]>
3126
</code>
32-
<code title="Invalid: Closing brace misaligned with opening brace.">
27+
<code title="Invalid: Closing brace misaligned with line containing opening brace.">
3328
<![CDATA[
3429
function foo()
3530
{
3631
echo 'opening brace at column 1';
3732
echo 'closing brace at column 2';
3833
<em> }</em>
3934
40-
class Foo {
41-
echo 'class keyword starts at column 1';
42-
echo 'closing brace at column 2';
43-
<em> }</em>
44-
45-
if ($a > $b) {
46-
echo 'conditional starts at column 1';
47-
echo 'closing brace at column 5';
48-
<em> }</em>
35+
if (!class_exists('Foo')) {
36+
class Foo {
37+
<em> }</em>
38+
<em> }</em>
4939
5040
<?php if ($something) { ?>
5141
<p>conditional opening tag at column 1</p>

0 commit comments

Comments
 (0)