Skip to content

Commit f77bddb

Browse files
committed
Merge branch 'feature/psr2-property-declaration-docs' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents e087e83 + 78a8478 commit f77bddb

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/Standards/PSR2/Docs/Classes/PropertyDeclarationStandard.xml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<documentation title="Property Declarations">
22
<standard>
33
<![CDATA[
4-
Property names should not be prefixed with an underscore to indicate visibility. Visibility should be used to declare properties rather than the var keyword. Only one property should be declared within a statement.
4+
Property names should not be prefixed with an underscore to indicate visibility. Visibility should be used to declare properties rather than the var keyword. Only one property should be declared within a statement. The static declaration must come after the visibility declaration.
55
]]>
66
</standard>
77
<code_comparison>
@@ -55,6 +55,25 @@ class Foo
5555
class Foo
5656
{
5757
private <em>$bar, $baz</em>;
58+
}
59+
]]>
60+
</code>
61+
</code_comparison>
62+
<code_comparison>
63+
<code title="Valid: If declared as static, the static declaration must come after the visibility declaration.">
64+
<![CDATA[
65+
class Foo
66+
{
67+
public <em>static</em> $bar;
68+
private $baz;
69+
}
70+
]]>
71+
</code>
72+
<code title="Invalid: Static declaration before the visibility declaration.">
73+
<![CDATA[
74+
class Foo
75+
{
76+
<em>static<em> protected $bar;
5877
}
5978
]]>
6079
</code>

0 commit comments

Comments
 (0)