Skip to content

Commit 30c0e34

Browse files
Merge pull request #49 from VincentLanglet/improveArrayRule
✨ Better checks for array rule
2 parents 1dd22e4 + f615dad commit 30c0e34

9 files changed

+171
-202
lines changed

SymfonyCustom/Sniffs/Arrays/ArrayDeclarationSniff.php

Lines changed: 68 additions & 170 deletions
Large diffs are not rendered by default.

SymfonyCustom/Sniffs/Commenting/DocCommentForbiddenTagsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class DocCommentForbiddenTagsSniff implements Sniff
2828
public function register()
2929
{
3030
return [
31-
T_DOC_COMMENT_TAG
31+
T_DOC_COMMENT_TAG,
3232
];
3333
}
3434

SymfonyCustom/Sniffs/Commenting/DocCommentGroupSameTypeSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class DocCommentGroupSameTypeSniff implements Sniff
5656
public function register()
5757
{
5858
return [
59-
T_DOC_COMMENT_OPEN_TAG
59+
T_DOC_COMMENT_OPEN_TAG,
6060
];
6161
}
6262

SymfonyCustom/Sniffs/Formatting/BlankLineBeforeReturnSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class BlankLineBeforeReturnSniff implements Sniff
2121
public function register()
2222
{
2323
return [
24-
T_RETURN
24+
T_RETURN,
2525
];
2626
}
2727

SymfonyCustom/Sniffs/WhiteSpace/DocCommentTagSpacingSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class DocCommentTagSpacingSniff implements Sniff
5656
public function register()
5757
{
5858
return [
59-
T_DOC_COMMENT_TAG
59+
T_DOC_COMMENT_TAG,
6060
];
6161
}
6262

SymfonyCustom/Sniffs/WhiteSpace/EmptyLinesSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class EmptyLinesSniff implements Sniff
1818
public function register()
1919
{
2020
return [
21-
T_WHITESPACE
21+
T_WHITESPACE,
2222
];
2323
}
2424

SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.inc

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,41 @@ class TestClass
7070
'short_name' => 'big'
7171
);
7272

73+
$array1 = [
74+
[
75+
'<span>',
76+
]
77+
,
78+
[
79+
'<span>',
80+
],
81+
];
82+
83+
$array2 = array(
84+
[
85+
'<span>',
86+
],[
87+
'<span>',
88+
],
89+
);
90+
91+
$array3 = array(
92+
'a' => ['<span>']
93+
,['<span>'],
94+
'b' => ['<span>']
95+
,['<span>'],
96+
);
97+
98+
$array4 = array(
99+
['<span>']
100+
,'a' => ['<span>'],
101+
['<span>']
102+
,'b' => ['<span>']
103+
);
104+
73105
$utf8 = array(
74-
'/[áàâãªäå]/u' => 'a',
75-
'/[ÁÀÂÃÄÅ]/u' => 'A',
106+
'/[áàâãªäå]/u' => 'a'
107+
,'/[ÁÀÂÃÄÅ]/u' => 'A',
76108
'/[ÍÌÎÏ]/u' => 'I',
77109
'/[íìîï]/u' => 'i',
78110
'/[éèêë]/u' => 'e',

SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.inc.fixed

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,38 @@ class TestClass
7070
'short_name' => 'big',
7171
);
7272

73+
$array1 = [
74+
[
75+
'<span>',
76+
],
77+
[
78+
'<span>',
79+
],
80+
];
81+
82+
$array2 = array(
83+
[
84+
'<span>',
85+
],
86+
[
87+
'<span>',
88+
],
89+
);
90+
91+
$array3 = array(
92+
'a' => ['<span>'],
93+
['<span>'],
94+
'b' => ['<span>'],
95+
['<span>'],
96+
);
97+
98+
$array4 = array(
99+
['<span>'],
100+
'a' => ['<span>'],
101+
['<span>'],
102+
'b' => ['<span>'],
103+
);
104+
73105
$utf8 = array(
74106
'/[áàâãªäå]/u' => 'a',
75107
'/[ÁÀÂÃÄÅ]/u' => 'A',

SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.php

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,38 @@ class ArrayDeclarationUnitTest extends AbstractSniffUnitTest
2222
public function getErrorList()
2323
{
2424
return [
25-
7 => 2,
26-
9 => 1,
27-
22 => 1,
28-
23 => 1,
29-
24 => 1,
30-
25 => 1,
31-
31 => 1,
32-
35 => 1,
33-
36 => 1,
34-
41 => 1,
35-
46 => 1,
36-
47 => 1,
37-
50 => 1,
38-
51 => 1,
39-
53 => 1,
40-
58 => 1,
41-
61 => 1,
42-
62 => 1,
43-
63 => 1,
44-
64 => 1,
45-
65 => 1,
46-
66 => 2,
47-
67 => 1,
48-
68 => 1,
49-
70 => 1,
25+
7 => 2,
26+
9 => 1,
27+
22 => 1,
28+
23 => 1,
29+
24 => 2,
30+
25 => 1,
31+
31 => 1,
32+
35 => 1,
33+
36 => 1,
34+
41 => 1,
35+
46 => 1,
36+
47 => 1,
37+
50 => 1,
38+
51 => 1,
39+
53 => 1,
40+
58 => 1,
41+
61 => 1,
42+
62 => 1,
43+
63 => 1,
44+
64 => 1,
45+
65 => 1,
46+
66 => 2,
47+
67 => 1,
48+
68 => 1,
49+
70 => 1,
50+
77 => 1,
51+
86 => 1,
52+
93 => 3,
53+
95 => 3,
54+
100 => 3,
55+
102 => 4,
56+
107 => 2,
5057
];
5158
}
5259

0 commit comments

Comments
 (0)