As part of the initiative to fix coding standards in Drupal core, a problem was discovered in the Drupal.Array.Array sniff. Ref. #2572613: Fix 'Drupal.Array.Array.CommaLastItem' coding standard.
It fails on the new array syntax, all lines get de-indented
'#cache' => [
- 'contexts' => $this->entityType->getListCacheContexts(),
+ 'contexts' => $this->entityType->getListCacheContexts(),
],
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | i2572587-12.patch | 13.01 KB | attiks |
| #9 | i2572587-9.patch | 13.17 KB | attiks |
| #8 | i2572587-8.patch | 13.29 KB | attiks |
| #7 | i2572587-7.patch | 11.18 KB | attiks |
| #4 | interdiff.txt | 2.06 KB | pfrenssen |
Comments
Comment #2
attiks commentedIt is even worse, the following does not get detected
Comment #3
attiks commentedFirst patch
Comment #4
pfrenssenAdded a test. This only specifically testing for warnings on the missing final commas, but since the phpcbf fixing of whitespace is also part of the test I guess this is sufficient to cover the whitespace bug.
Comment #5
pfrenssenComment #6
attiks commentedAdd support for nested short arrays
Comment #7
attiks commentedIgnore #6
Comment #8
attiks commentedAdded more tests
Comment #9
attiks commentedFixed the unit tests
Comment #10
pfrenssenGreat work, nice test coverage was added, and it's all green!
Comment #11
klausiMakes sense, please use the PHPCS coding standard for our sniff code (4 space indentation etc) to be in line with PHPCS code and to be consistent in one file.
Comment #12
attiks commentedPatch fixing - hopefully - the coding standards
Comment #14
klausiDid a bit of cleanup by running "phpcs --standard=PHPCS" on the file. Committed, thanks!
Comment #16
klausiFollow-up: #2580017: Short array syntax false positives