Skip to content

Commit c4fe690

Browse files
author
Vincent Langlet
committed
✨ Improve checks about array declaration and operators
1 parent 052f7bf commit c4fe690

19 files changed

+1020
-586
lines changed

Symfony3Custom/Sniffs/Arrays/ArrayDeclarationSniff.php

Lines changed: 788 additions & 0 deletions
Large diffs are not rendered by default.

Symfony3Custom/Sniffs/Arrays/MultiLineArrayCommaSniff.php

Lines changed: 0 additions & 96 deletions
This file was deleted.

Symfony3Custom/Sniffs/WhiteSpace/AssignmentSpacingSniff.php

Lines changed: 0 additions & 60 deletions
This file was deleted.

Symfony3Custom/Sniffs/WhiteSpace/BinaryOperatorSpacingSniff.php

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
function test()
4+
{
5+
$a = array();
6+
7+
$b = Array ();
8+
9+
$c = Array(
10+
'a' => 1,
11+
);
12+
}
13+
14+
15+
class TestClass
16+
{
17+
public $good = array(
18+
'width' => '',
19+
'height' => '',
20+
);
21+
22+
private $_bad = Array(
23+
'width' => '',
24+
'height' => ''
25+
);
26+
27+
28+
public function test()
29+
{
30+
$truck = array(
31+
'width' => '',
32+
'height' => '',
33+
);
34+
35+
$plane = Array(
36+
'width' => '',
37+
'height' => '',
38+
);
39+
40+
$car = array(
41+
'width' => '',
42+
'height' => '',
43+
);
44+
45+
$bus = array(
46+
'width' => '',
47+
'height' => ''
48+
);
49+
50+
$train = array (
51+
TRUE,
52+
FALSE,
53+
'aaa'
54+
);
55+
56+
$inline = array('aaa', 'bbb', 'ccc');
57+
$inline = array('aaa');
58+
$inline = Array('aaa');
59+
60+
$bigone = array(
61+
'name' => 'bigone',
62+
'children' => Array(
63+
'1a' => 'child',
64+
'11b' => 'child',
65+
'111c' => 'child',
66+
'children' => Array(
67+
'child' => 'aaa',
68+
),
69+
),
70+
'short_name' => 'big'
71+
);
72+
}
73+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
function test()
4+
{
5+
$a = array();
6+
7+
$b = array();
8+
9+
$c = array(
10+
'a' => 1,
11+
);
12+
}
13+
14+
15+
class TestClass
16+
{
17+
public $good = array(
18+
'width' => '',
19+
'height' => '',
20+
);
21+
22+
private $_bad = array(
23+
'width' => '',
24+
'height' => '',
25+
);
26+
27+
28+
public function test()
29+
{
30+
$truck = array(
31+
'width' => '',
32+
'height' => '',
33+
);
34+
35+
$plane = array(
36+
'width' => '',
37+
'height' => '',
38+
);
39+
40+
$car = array(
41+
'width' => '',
42+
'height' => '',
43+
);
44+
45+
$bus = array(
46+
'width' => '',
47+
'height' => '',
48+
);
49+
50+
$train = array(
51+
TRUE,
52+
FALSE,
53+
'aaa',
54+
);
55+
56+
$inline = array('aaa', 'bbb', 'ccc');
57+
$inline = array('aaa');
58+
$inline = array('aaa');
59+
60+
$bigone = array(
61+
'name' => 'bigone',
62+
'children' => array(
63+
'1a' => 'child',
64+
'11b' => 'child',
65+
'111c' => 'child',
66+
'children' => array(
67+
'child' => 'aaa',
68+
),
69+
),
70+
'short_name' => 'big',
71+
);
72+
}
73+
}

0 commit comments

Comments
 (0)