File tree Expand file tree Collapse file tree 1 file changed +107
-0
lines changed
src/Standards/Generic/Docs/Arrays Expand file tree Collapse file tree 1 file changed +107
-0
lines changed Original file line number Diff line number Diff line change 1+ <documentation title =" Array Indent" >
2+ <standard >
3+ <![CDATA[
4+ The opening brace of a multi-line array must be indented at least to the same level as the start of the statement.
5+ ]]>
6+ </standard >
7+ <code_comparison >
8+ <code title =" Valid: Opening brace of a multi-line array indented to the same level as the start of the statement." >
9+ <![CDATA[
10+ $b = <em>[</em>
11+ 1,
12+ 2,
13+ ];
14+
15+ if ($condition) {
16+ $a =
17+ <em> [</em>
18+ 1,
19+ 2,
20+ ];
21+ }
22+
23+ ]]>
24+ </code >
25+ <code title =" Invalid: Opening brace of a multi-line array not indented to the same level as the start of the statement." >
26+ <![CDATA[
27+ if ($condition) {
28+ $a =
29+ <em>[</em>
30+ 1,
31+ 2,
32+ ];
33+ }
34+ ]]>
35+ </code >
36+ </code_comparison >
37+ <standard >
38+ <![CDATA[
39+ Each array element must be indented exactly four spaces from the start of the statement.
40+ ]]>
41+ </standard >
42+ <code_comparison >
43+ <code title =" Valid: Each array element is indented by exactly four spaces." >
44+ <![CDATA[
45+ $a = array(
46+ <em> </em>1,
47+ <em> </em>2,
48+ <em> </em>3,
49+ );
50+ ]]>
51+ </code >
52+ <code title =" Invalid: Array elements not indented by four spaces." >
53+ <![CDATA[
54+ $a = array(
55+ <em> </em>1,
56+ <em> </em>2,
57+ <em> </em>3,
58+ );
59+ ]]>
60+ </code >
61+ </code_comparison >
62+ <standard >
63+ <![CDATA[
64+ The array closing brace must be on a new line.
65+ ]]>
66+ </standard >
67+ <code_comparison >
68+ <code title =" Valid: Array closing brace on its own line." >
69+ <![CDATA[
70+ $a = [
71+ 1,
72+ 2,<em>
73+ ]</em>;
74+ ]]>
75+ </code >
76+ <code title =" Invalid: Array closing brace not on its own line." >
77+ <![CDATA[
78+ $a = [
79+ 1,
80+ 2,<em>]</em>;
81+ ]]>
82+ </code >
83+ </code_comparison >
84+ <standard >
85+ <![CDATA[
86+ The closing brace must be aligned with the start of the statement containing the array opener.
87+ ]]>
88+ </standard >
89+ <code_comparison >
90+ <code title =" Valid: Closing brace aligned with the start of the statement containing the array opener." >
91+ <![CDATA[
92+ $a = array(
93+ 1,
94+ 2,
95+ <em>)</em>;
96+ ]]>
97+ </code >
98+ <code title =" Invalid: Closing brace not aligned with the start of the statement containing the array opener." >
99+ <![CDATA[
100+ $a = array(
101+ 1,
102+ 2,
103+ <em> )</em>;
104+ ]]>
105+ </code >
106+ </code_comparison >
107+ </documentation >
You can’t perform that action at this time.
0 commit comments