Skip to content

Commit 0856a63

Browse files
Merge pull request #102 from VincentLanglet/uselessCheck
💄 Remove duplicate check
2 parents 606c99d + 892643c commit 0856a63

File tree

3 files changed

+9
-28
lines changed

3 files changed

+9
-28
lines changed

SymfonyCustom/Sniffs/Arrays/ArrayDeclarationSniff.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,6 @@ public function process(File $phpcsFile, $stackPtr): void
3636
$tokens = $phpcsFile->getTokens();
3737

3838
if (T_ARRAY === $tokens[$stackPtr]['code']) {
39-
// Array keyword should be lower case.
40-
if (strtolower($tokens[$stackPtr]['content']) !== $tokens[$stackPtr]['content']) {
41-
$fix = $phpcsFile->addFixableError(
42-
'Array keyword should be lower case; expected "array" but found "%s"',
43-
$stackPtr,
44-
'NotLowerCase',
45-
[$tokens[$stackPtr]['content']]
46-
);
47-
48-
if ($fix) {
49-
$phpcsFile->fixer->replaceToken($stackPtr, 'array');
50-
}
51-
}
52-
5339
$arrayStart = $tokens[$stackPtr]['parenthesis_opener'];
5440
if (!isset($tokens[$arrayStart]['parenthesis_closer'])) {
5541
return;

SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.inc.fixed

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ function test()
44
{
55
$a = array();
66

7-
$b = array();
7+
$b = Array();
88

9-
$c = array(
9+
$c = Array(
1010
'a' => 1,
1111
);
1212
}
@@ -19,7 +19,7 @@ class TestClass
1919
'height' => '',
2020
);
2121

22-
private $_bad = array(
22+
private $_bad = Array(
2323
'width' => '',
2424
'height' => '',
2525
);
@@ -32,7 +32,7 @@ class TestClass
3232
'height' => '',
3333
);
3434

35-
$plane = array(
35+
$plane = Array(
3636
'width' => '',
3737
'height' => '',
3838
);
@@ -55,15 +55,15 @@ class TestClass
5555

5656
$inline = array('aaa', 'bbb', 'ccc');
5757
$inline = array('aaa');
58-
$inline = array('aaa');
58+
$inline = Array('aaa');
5959

6060
$bigone = array(
6161
'name' => 'bigone',
62-
'children' => array(
62+
'children' => Array(
6363
'1a' => 'child',
6464
'11b' => 'child',
6565
'111c' => 'child',
66-
'children' => array(
66+
'children' => Array(
6767
'child' => 'aaa',
6868
),
6969
),

SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,23 @@ class ArrayDeclarationUnitTest extends AbstractSniffUnitTest
1919
protected function getErrorList(): array
2020
{
2121
return [
22-
7 => 2,
23-
9 => 1,
24-
22 => 1,
22+
7 => 1,
2523
23 => 1,
2624
24 => 2,
2725
25 => 1,
2826
31 => 1,
29-
35 => 1,
3027
36 => 1,
3128
41 => 1,
3229
46 => 1,
3330
47 => 1,
3431
50 => 1,
3532
51 => 1,
3633
53 => 1,
37-
58 => 1,
3834
61 => 1,
39-
62 => 1,
4035
63 => 1,
4136
64 => 1,
4237
65 => 1,
43-
66 => 2,
38+
66 => 1,
4439
67 => 1,
4540
68 => 1,
4641
70 => 1,

0 commit comments

Comments
 (0)