Skip to content

[Documentation] Squiz: Member Var Spacing #373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions src/Standards/Squiz/Docs/WhiteSpace/MemberVarSpacingStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<documentation title="Member Var Spacing">
<standard>
<![CDATA[
There should be exactly one blank line before the first property (member variable).
]]>
</standard>
<code_comparison>
<code title="Valid: One blank line before the first property.">
<![CDATA[
class MyClass
{<em>

</em> protected $var1 = 'value';
}
]]>
</code>
<code title="Invalid: Incorrect number of blank lines before the first property.">
<![CDATA[
class MyClass
{<em>
</em> protected $var1 = 'value';
}
]]>
</code>
</code_comparison>
<standard>
<![CDATA[
There should be exactly one blank line between properties.
]]>
</standard>
<code_comparison>
<code title="Valid: One blank line between each property.">
<![CDATA[
trait MyTrait {

public $var1 = 'value';<em>

</em> public $var2 = 'value2';<em>

</em> public $var3 = 'value3';
}
]]>
</code>
<code title="Invalid: Incorrect number of blank lines between each property.">
<![CDATA[
trait MyTrait {

public $var1 = 'value';<em>


</em> public $var2 = 'value2';<em>
</em> public $var3 = 'value3';
}
]]>
</code>
</code_comparison>
<standard>
<![CDATA[
There should be no blank lines between a property DocBlock and the property declaration the DocBlock applies to.
]]>
</standard>
<code_comparison>
<code title="Valid: No blank lines between DocBlock and its property.">
<![CDATA[
$anon = new class {

/**
* The actions that this class can perform.
*
* @var array
*/<em>
</em> public $actions = array();
};
]]>
</code>
<code title="Invalid: Blank line(s) between DocBlock and its property.">
<![CDATA[
$anon = new class {

/**
* The actions that this class can perform.
*
* @var array
*/<em>

</em> public $actions = array();
};
]]>
</code>
</code_comparison>
</documentation>