Skip to content

Docs/WordPress.Arrays.ArrayIndentation #1744

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
merged 6 commits into from
Oct 13, 2019
Merged
Changes from 1 commit
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
52 changes: 52 additions & 0 deletions WordPress/Docs/Arrays/ArrayIndentationStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<documentation title="Array Indentation">
<standard>
<![CDATA[
The array closing bracket and indentation should line up with the start of the content on the line containing the array opener.
]]>
</standard>
<code_comparison>
<code title="Valid: Closing bracket lined up correctly">
<![CDATA[
$args = array(
'post_id' => 22,
<em>);</em>
]]>
</code>
<code title="Invalid: Closing bracket lined up incorrectly">
<![CDATA[
$args = array(
'post_id' => 22,
<em>);</em>
]]>
</code>
</code_comparison>
<standard>
<![CDATA[
Keys in each array and nested array should be indented by a 4-space tab for each level of nested array, so that the array visually matches its structure.
]]>
</standard>
<code_comparison>
<code title="Valid: Correctly indented array">
<![CDATA[
$args = array(
'post_id' => 22,
'comment_count' => array(
<em>'value' => 25,
'compare' => '>=',</em>
),
);
]]>
</code>
<code title="Invalid: Indented incorrectly; harder to read.">
<![CDATA[
$args = array(
'post_id' => 22,
'comment_count' => array(
<em>'value' => 25,
'compare' => '>=',</em>
),
);
]]>
</code>
</code_comparison>
</documentation>