Skip to content

Commit 05b23e9

Browse files
committed
[Doc] Add XML doc for Squiz ClassDeclaration sniff
This sniff inherits from a PSR2 sniff which inherits from PEAR, so I'm not sure how much to document here. For now I've documented only the checks added by the Squiz version.
1 parent 894bf72 commit 05b23e9

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<documentation title="Class Declaration">
2+
<standard>
3+
<![CDATA[
4+
Only one interface or class is allowed in a file.
5+
]]>
6+
</standard>
7+
<code_comparison>
8+
<code title="Valid: One class declaration per file.">
9+
<![CDATA[
10+
class Foo implements Bar
11+
{
12+
}
13+
]]>
14+
</code>
15+
<code title="Invalid: More than one class or interface per file.">
16+
<![CDATA[
17+
<em>class Foo implements Bar</em>
18+
{
19+
}
20+
21+
<em>interface Bar</em>
22+
{
23+
}
24+
]]>
25+
</code>
26+
</code_comparison>
27+
<standard>
28+
<![CDATA[
29+
No whitespace allowed before the class declaration keywords.
30+
]]>
31+
</standard>
32+
<code_comparison>
33+
<code title="Valid: No whitespace before class declaration keywords.">
34+
<![CDATA[
35+
<em></em>abstract class Foo
36+
{
37+
}
38+
]]>
39+
</code>
40+
<code title="Invalid: Whitespace before class declaration
41+
keywords.">
42+
<![CDATA[
43+
<em> </em>abstract class Foo
44+
{
45+
}
46+
]]>
47+
</code>
48+
</code_comparison>
49+
<standard>
50+
<![CDATA[
51+
Closing brace of a class or interface must be followed by a single blank line.
52+
]]>
53+
</standard>
54+
<code_comparison>
55+
<code title="Valid: Single blank line after closing brace.">
56+
<![CDATA[
57+
class Foo
58+
{
59+
}
60+
<em></em>
61+
]]>
62+
</code>
63+
<code title="Invalid: No blank line after closing brace.">
64+
<![CDATA[
65+
class Foo
66+
{
67+
}<em></em>
68+
]]>
69+
</code>
70+
</code_comparison>
71+
<standard>
72+
<![CDATA[
73+
Closing brace of a class or interface must be on a line by itself.
74+
]]>
75+
</standard>
76+
<code_comparison>
77+
<code title="Valid: Closing brace is on a line by itself.">
78+
<![CDATA[
79+
class Foo
80+
{
81+
<em>}</em>
82+
]]>
83+
</code>
84+
<code title="Invalid: Closing brace is not on a line by itself.">
85+
<![CDATA[
86+
class Foo
87+
{<em>}</em>
88+
]]>
89+
</code>
90+
</code_comparison>
91+
<code_comparison>
92+
<code title="Valid: No whitespace before closing brace.">
93+
<![CDATA[
94+
class Foo
95+
{
96+
<em>}</em>
97+
]]>
98+
</code>
99+
<code title="Invalid: Whitespace before closing brace.">
100+
<![CDATA[
101+
class Foo
102+
{
103+
<em> </em>}
104+
]]>
105+
</code>
106+
</code_comparison>
107+
</documentation>

0 commit comments

Comments
 (0)