3

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',
];
trckster
  • 430
  • 1
  • 6
  • 11

1 Answers1

-1

I believe that should work:

'trailing_comma_in_multiline' => ['elements' => []]

https://cs.symfony.com/doc/rules/control_structure/trailing_comma_in_multiline.html

Juliano Petronetto
  • 1,067
  • 13
  • 15