File tree Expand file tree Collapse file tree 3 files changed +22
-62
lines changed Expand file tree Collapse file tree 3 files changed +22
-62
lines changed Original file line number Diff line number Diff line change @@ -135,45 +135,25 @@ public static function dataExtractCodeBlocks(): array
135
135
'expectedResult ' => [
136
136
'valid ' => [
137
137
new CodeBlock (
138
- 'Valid: Opening square bracket/parenthesis token of a multi-line array indented at least to the same level of the start of the statement. ' ,
139
- 'if ($condition) {
140
- $a =
141
- [
142
- 1,
143
- 2,
144
- ];
145
- } ' ,
138
+ 'Valid: Example of a valid code block. ' ,
139
+ '// Some PHP code that does not trigger the sniff. ' ,
146
140
0
147
141
),
148
142
new CodeBlock (
149
- 'Valid: Elements of an array indented four spaces beyond the indentation level of the opening square bracket/parenthesis. ' ,
150
- '$a = array(
151
- 1,
152
- 2,
153
- 3,
154
- ); ' ,
143
+ 'Valid: Another example of a valid code block. ' ,
144
+ '// Another PHP code that does not trigger the sniff. ' ,
155
145
1
156
146
),
157
147
],
158
148
'invalid ' => [
159
149
new CodeBlock (
160
- 'Invalid: Opening square bracket/parenthesis of a multi-line array not indented at least to the same level of the start of the statement. ' ,
161
- 'if ($condition) {
162
- $a =
163
- [
164
- 1,
165
- 2,
166
- ];
167
- } ' ,
150
+ 'Invalid: Example of an invalid code block. ' ,
151
+ '// Some PHP code that does trigger the sniff. ' ,
168
152
2
169
153
),
170
154
new CodeBlock (
171
- 'Invalid: Elements of an array not indented four spaces beyond the indentation level of the opening square bracket/parenthesis. ' ,
172
- '$a = array(
173
- 1,
174
- 2,
175
- 3,
176
- ); ' ,
155
+ 'Invalid: Another example of an invalid code block. ' ,
156
+ '// Another PHP code that does trigger the sniff. ' ,
177
157
3
178
158
),
179
159
],
Original file line number Diff line number Diff line change 1
- <documentation title =" Array Indent " >
1
+ <documentation title =" One Valid Block " >
2
2
<standard >
3
3
<![CDATA[
4
- The opening square bracket/parenthesis of a multi-line array must be indented at least to the same level of the start of the statement .
4
+ This is a test file with one valid code block .
5
5
]]>
6
6
</standard >
7
7
<code_comparison >
8
8
<code title =" Valid: Example of a valid code block." >
9
9
<![CDATA[
10
- // Some PHP code.
10
+ // Some PHP code.
11
11
]]>
12
12
</code >
13
13
</code_comparison >
Original file line number Diff line number Diff line change 1
- <documentation title =" Array Indent " >
1
+ <documentation title =" Valid And Invalid Blocks " >
2
2
<standard >
3
3
<![CDATA[
4
- The opening square bracket/parenthesis of a multi-line array must be indented at least to the same level of the start of the statement .
4
+ This is a test file with valid and invalid code blocks .
5
5
]]>
6
6
</standard >
7
7
<code_comparison >
8
- <code title =" Valid: Opening square bracket/parenthesis token of a multi-line array indented at least to the same level of the start of the statement ." >
8
+ <code title =" Valid: Example of a valid code block ." >
9
9
<![CDATA[
10
- if ($condition) {
11
- $a =
12
- <em> [</em>
13
- 1,
14
- 2,
15
- ];
16
- }
10
+ // Some PHP code that does not trigger the sniff.
17
11
]]>
18
12
</code >
19
- <code title =" Invalid: Opening square bracket/parenthesis of a multi-line array not indented at least to the same level of the start of the statement ." >
13
+ <code title =" Invalid: Example of an invalid code block ." >
20
14
<![CDATA[
21
- if ($condition) {
22
- $a =
23
- <em>[</em>
24
- 1,
25
- 2,
26
- ];
27
- }
15
+ // Some PHP code that does trigger the sniff.
28
16
]]>
29
17
</code >
30
18
</code_comparison >
31
19
<standard >
32
20
<![CDATA[
33
- The elements of an array must be indented four spaces beyond the indentation level of the opening square bracket/parenthesis .
21
+ Another <standard> block in this test file with valid and invalid code blocks .
34
22
]]>
35
23
</standard >
36
24
<code_comparison >
37
- <code title =" Valid: Elements of an array indented four spaces beyond the indentation level of the opening square bracket/parenthesis ." >
25
+ <code title =" Valid: Another example of a valid code block ." >
38
26
<![CDATA[
39
- $a = array(
40
- <em> 1</em>,
41
- <em> 2</em>,
42
- <em> 3</em>,
43
- );
27
+ // Another PHP code that does not trigger the sniff.
44
28
]]>
45
29
</code >
46
- <code title =" Invalid: Elements of an array not indented four spaces beyond the indentation level of the opening square bracket/parenthesis ." >
30
+ <code title =" Invalid: Another example of an invalid code block ." >
47
31
<![CDATA[
48
- $a = array(
49
- <em> 1</em>,
50
- 2,
51
- <em> 3</em>,
52
- );
32
+ // Another PHP code that does trigger the sniff.
53
33
]]>
54
34
</code >
55
35
</code_comparison >
You can’t perform that action at this time.
0 commit comments