Open
Description
I think it makes sense to adjust our config for trailing_comma_in_multiline.
Currently we only enforce trailing commas in parameters, this is great to make git diff cleaner when adding new parameters.
But the same also applies to the function call, arrays and match
in general.
So how about changing it to 'trailing_comma_in_multiline' => ['elements' => ['arguments', 'arrays', 'match', 'parameters']]
.
Caused code changes
doSomething(
$first,
- $second
+ $second,
);
return match($something) {
1 => 'one',
- 2 => 'two'
+ 2 => 'two',
};
$arr = [
1,
- 2
+ 2,
];
Reason
This would allow all those cases to benefit from smaller diff on new array members / arguments.
Before:
$arr = [
1,
- 2
+ 2,
+ 3
];
After:
$arr = [
1,
2,
+ 3,
];