Skip to content

Commit 8c065c4

Browse files
committed
Adds docs for WordPress.Arrays.ArrayIndentation
1 parent d202e46 commit 8c065c4

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<documentation title="Array Indentation">
2+
<standard>
3+
<![CDATA[
4+
The array closing bracket and indentation should line up with the start of the content on the line containing the array opener.
5+
]]>
6+
</standard>
7+
<code_comparison>
8+
<code title="Valid: Closing bracket lined up correctly">
9+
<![CDATA[
10+
$args = array(
11+
'post_id' => 22,
12+
<em>);</em>
13+
]]>
14+
</code>
15+
<code title="Invalid: Closing bracket lined up incorrectly">
16+
<![CDATA[
17+
$args = array(
18+
'post_id' => 22,
19+
<em>);</em>
20+
]]>
21+
</code>
22+
</code_comparison>
23+
<standard>
24+
<![CDATA[
25+
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.
26+
]]>
27+
</standard>
28+
<code_comparison>
29+
<code title="Valid: Correctly indented array">
30+
<![CDATA[
31+
$args = array(
32+
'post_id' => 22,
33+
'comment_count' => array(
34+
<em>'value' => 25,
35+
'compare' => '>=',</em>
36+
),
37+
);
38+
]]>
39+
</code>
40+
<code title="Invalid: Indented incorrectly; harder to read.">
41+
<![CDATA[
42+
$args = array(
43+
'post_id' => 22,
44+
'comment_count' => array(
45+
<em>'value' => 25,
46+
'compare' => '>=',</em>
47+
),
48+
);
49+
]]>
50+
</code>
51+
</code_comparison>
52+
</documentation>

0 commit comments

Comments
 (0)