Closed kenjis closed 2 years ago
<?php
return [
'notImplemented' => '"{0}" action not implemented.',
];
$ ./vendor/bin/phpcs --standard=./vendor/codeigniter4/codeigniter4-standard/CodeIgniter4 system/Sample.php
FILE: /Users/kenji/work/codeigniter/CodeIgniter4/system/Sample.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
2 | ERROR | [ ] Missing file doc comment
4 | ERROR | [x] Array key not aligned correctly; expected 0.75 tab but found 1
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 86ms; Memory: 10MB
It seems the rule is: https://github.com/codeigniter4/coding-standard/blob/b7c6fe477264db450f8b6fbee5886b181b0eb3f1/CodeIgniter4/Sniffs/Arrays/ArrayDeclarationSniff.php#L812
Sorry, I can't read the code...
I've noticed this too and always have to exclude language files from the standard.
It seems to fix this rule is difficult and time consuming. So I sent workaround PR: #44
i think problem in new $data
format:
$data = [
$expected,
Common::pluralize('space', $expected),
$found,
];
$fix = $phpcsFile->addFixableError($error, $index['arrow'], 'ValueNotAligned', $data);
if old sniff dont have other differences, then better replace it to new native sniff.
When I run phpcbf, it replaces indentation tab with 3 spaces in array.
command:
before:
after: