Reputation: 610
I'm using PHP-CS-Fixer to set up linting in project. There is a rule trailing_comma_in_multiline
. It lets you to check whether all multiple-lines arrays have trailing commas.
Is it possible to reverse this logic and check whether all multiple-lines arrays have NO trailing commas?
In other words I want this syntax to be valid:
$data = [
'First item',
'Second item'
];
And this syntax to throw an error when checking with PHP-CS-Fixer:
$data = [
'First item',
'Second item',
];
Upvotes: 3
Views: 1170
Reputation: 1167
I believe that should work:
'trailing_comma_in_multiline' => ['elements' => []]
https://cs.symfony.com/doc/rules/control_structure/trailing_comma_in_multiline.html
Upvotes: -1