File tree Expand file tree Collapse file tree 2 files changed +41
-34
lines changed
SlevomatCodingStandard/Helpers Expand file tree Collapse file tree 2 files changed +41
-34
lines changed Original file line number Diff line number Diff line change 3
3
namespace SlevomatCodingStandard \Helpers ;
4
4
5
5
use PHP_CodeSniffer \Files \File ;
6
+ use function array_reverse ;
7
+ use function current ;
6
8
use function in_array ;
7
9
use function ltrim ;
8
10
use function rtrim ;
9
11
use function strpos ;
10
12
use function trim ;
13
+ use const T_CLOSURE ;
11
14
use const T_COMMA ;
12
15
use const T_DOUBLE_ARROW ;
13
16
use const T_ELLIPSIS ;
@@ -119,6 +122,10 @@ private function addValues(File $phpcsFile): void
119
122
}
120
123
121
124
if ($ token ['code ' ] === T_DOUBLE_ARROW ) {
125
+ if (current (array_reverse ($ token ['conditions ' ])) === T_CLOSURE ) {
126
+ continue ;
127
+ }
128
+
122
129
$ this ->pointerArrow = $ i ;
123
130
continue ;
124
131
}
Original file line number Diff line number Diff line change 1
1
<?php // lint >= 7.4
2
2
3
- // [];
4
- //
5
- // array();
6
- //
7
- // ['foo', 'bar', 'baz'];
8
- //
9
- // array('foo', 'bar', 'baz');
10
- //
11
- // $a = [
12
- // 0 => 'zero',
13
- // 'foo' => 'foo',
14
- // 'bar' => 'bar',
15
- // 'baz' => 'baz'
16
- // ];
17
- //
18
- // array(
19
- // 0 => 'zero',
20
- // 'foo' => 'foo',
21
- // ...$a,
22
- // 'bar' => 'bar',
23
- // 'baz' => 'baz',
24
- // ...$a
25
- // );
26
- //
27
- // [
28
- // 'bail',
29
- // 'array',
30
- // 'required',
31
- // static function (array $value): array {
32
- // foreach ($value as $x => $z) {
33
- // $x + $z;
34
- // }
35
- // },
36
- // ];
3
+ [];
4
+
5
+ array ();
6
+
7
+ ['foo ' , 'bar ' , 'baz ' ];
8
+
9
+ array ('foo ' , 'bar ' , 'baz ' );
10
+
11
+ $ a = [
12
+ 0 => 'zero ' ,
13
+ 'foo ' => 'foo ' ,
14
+ 'bar ' => 'bar ' ,
15
+ 'baz ' => 'baz '
16
+ ];
17
+
18
+ array (
19
+ 0 => 'zero ' ,
20
+ 'foo ' => 'foo ' ,
21
+ ...$ a ,
22
+ 'bar ' => 'bar ' ,
23
+ 'baz ' => 'baz ' ,
24
+ ...$ a
25
+ );
26
+
27
+ [
28
+ 'bail ' ,
29
+ 'array ' ,
30
+ 'required ' ,
31
+ static function (array $ value ): array {
32
+ foreach ($ value as $ x => $ z ) {
33
+ $ x + $ z ;
34
+ }
35
+ },
36
+ ];
37
37
38
38
['newsletter ' => [], 'campaign ' => [], 'other ' => []];
39
39
You can’t perform that action at this time.
0 commit comments