@@ -36,16 +36,8 @@ public function process(File $phpcsFile, $stackPtr): void
36
36
$ tokens = $ phpcsFile ->getTokens ();
37
37
38
38
if (T_ARRAY === $ tokens [$ stackPtr ]['code ' ]) {
39
- $ phpcsFile ->recordMetric ($ stackPtr , 'Short array syntax used ' , 'no ' );
40
-
41
39
// Array keyword should be lower case.
42
40
if (strtolower ($ tokens [$ stackPtr ]['content ' ]) !== $ tokens [$ stackPtr ]['content ' ]) {
43
- if (strtoupper ($ tokens [$ stackPtr ]['content ' ]) === $ tokens [$ stackPtr ]['content ' ]) {
44
- $ phpcsFile ->recordMetric ($ stackPtr , 'Array keyword case ' , 'upper ' );
45
- } else {
46
- $ phpcsFile ->recordMetric ($ stackPtr , 'Array keyword case ' , 'mixed ' );
47
- }
48
-
49
41
$ fix = $ phpcsFile ->addFixableError (
50
42
'Array keyword should be lower case; expected "array" but found "%s" ' ,
51
43
$ stackPtr ,
@@ -56,8 +48,6 @@ public function process(File $phpcsFile, $stackPtr): void
56
48
if ($ fix ) {
57
49
$ phpcsFile ->fixer ->replaceToken ($ stackPtr , 'array ' );
58
50
}
59
- } else {
60
- $ phpcsFile ->recordMetric ($ stackPtr , 'Array keyword case ' , 'lower ' );
61
51
}
62
52
63
53
$ arrayStart = $ tokens [$ stackPtr ]['parenthesis_opener ' ];
@@ -79,7 +69,6 @@ public function process(File $phpcsFile, $stackPtr): void
79
69
}
80
70
}
81
71
} else {
82
- $ phpcsFile ->recordMetric ($ stackPtr , 'Short array syntax used ' , 'yes ' );
83
72
$ arrayStart = $ stackPtr ;
84
73
$ arrayEnd = $ tokens [$ stackPtr ]['bracket_closer ' ];
85
74
}
@@ -449,17 +438,15 @@ public function processMultiLineArray(File $phpcsFile, int $stackPtr, int $start
449
438
);
450
439
451
440
if (T_COMMA !== $ tokens [$ trailingContent ]['code ' ]) {
452
- $ phpcsFile ->recordMetric ($ stackPtr , 'Array end comma ' , 'no ' );
453
441
$ fix = $ phpcsFile ->addFixableError (
454
442
'Comma required after last value in array declaration ' ,
455
443
$ trailingContent ,
456
444
'NoCommaAfterLast '
457
445
);
446
+
458
447
if ($ fix ) {
459
448
$ phpcsFile ->fixer ->addContent ($ trailingContent , ', ' );
460
449
}
461
- } else {
462
- $ phpcsFile ->recordMetric ($ stackPtr , 'Array end comma ' , 'yes ' );
463
450
}
464
451
465
452
$ lastValueLine = $ stackPtr ;
0 commit comments