Skip to content

Commit 776bc88

Browse files
authored
[Documentation] Squiz: Member Var Spacing (#373)
* Docs: add documentation for Squiz.WhiteSpace.MemberVarSpacing * Docs: improve code examples and descriptions for Squiz.WhiteSpace.MemberVarSpacing - Remove invalid structures - Clarify and improve wording (member var => property) - Remove excessive code examples - Clarify and improve wording (comment => DocBlock) * Docs: add more specific wording to Squiz.WhiteSpace.MemberVarSpacing * Docs: update code example for Squiz.WhiteSpace.MemberVarSpacing Show both too much and too little whitespace in one example * Docs: adjust code example for Squiz.WhiteSpace.MemberVarSpacing - Add anonymous class assignment and missing semi-colons
1 parent 56954db commit 776bc88

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<documentation title="Member Var Spacing">
2+
<standard>
3+
<![CDATA[
4+
There should be exactly one blank line before the first property (member variable).
5+
]]>
6+
</standard>
7+
<code_comparison>
8+
<code title="Valid: One blank line before the first property.">
9+
<![CDATA[
10+
class MyClass
11+
{<em>
12+
13+
</em> protected $var1 = 'value';
14+
}
15+
]]>
16+
</code>
17+
<code title="Invalid: Incorrect number of blank lines before the first property.">
18+
<![CDATA[
19+
class MyClass
20+
{<em>
21+
</em> protected $var1 = 'value';
22+
}
23+
]]>
24+
</code>
25+
</code_comparison>
26+
<standard>
27+
<![CDATA[
28+
There should be exactly one blank line between properties.
29+
]]>
30+
</standard>
31+
<code_comparison>
32+
<code title="Valid: One blank line between each property.">
33+
<![CDATA[
34+
trait MyTrait {
35+
36+
public $var1 = 'value';<em>
37+
38+
</em> public $var2 = 'value2';<em>
39+
40+
</em> public $var3 = 'value3';
41+
}
42+
]]>
43+
</code>
44+
<code title="Invalid: Incorrect number of blank lines between each property.">
45+
<![CDATA[
46+
trait MyTrait {
47+
48+
public $var1 = 'value';<em>
49+
50+
51+
</em> public $var2 = 'value2';<em>
52+
</em> public $var3 = 'value3';
53+
}
54+
]]>
55+
</code>
56+
</code_comparison>
57+
<standard>
58+
<![CDATA[
59+
There should be no blank lines between a property DocBlock and the property declaration the DocBlock applies to.
60+
]]>
61+
</standard>
62+
<code_comparison>
63+
<code title="Valid: No blank lines between DocBlock and its property.">
64+
<![CDATA[
65+
$anon = new class {
66+
67+
/**
68+
* The actions that this class can perform.
69+
*
70+
* @var array
71+
*/<em>
72+
</em> public $actions = array();
73+
};
74+
]]>
75+
</code>
76+
<code title="Invalid: Blank line(s) between DocBlock and its property.">
77+
<![CDATA[
78+
$anon = new class {
79+
80+
/**
81+
* The actions that this class can perform.
82+
*
83+
* @var array
84+
*/<em>
85+
86+
</em> public $actions = array();
87+
};
88+
]]>
89+
</code>
90+
</code_comparison>
91+
</documentation>

0 commit comments

Comments
 (0)