-
Task
-
Resolution: Fixed
-
Low
-
None
Since 20th May 2020, this rule applies:
- The uses of a trailing comma on multi-line array declaration is required in PHP and JS.
- It's NOT required to change all current old-style occurrences in the codebase. We'll follow a progressive approach here (new code and modified code)
For example for the expected format:
$foo = [
'a',
'b',
'c',
];
I'd like to propose that we recommend or require the use of a trailing comma on multi-line array declarations, in PHP and JS.
For example:
$foo = [
|
'a',
|
'b',
|
'c',
|
];
|
Rationale:
- Adding additional keys to the array later leads to fewer lines of diff (1 addition, vs. 1 removal + 2 addition)
- Git blame and git history are clearer.
So this is a proposal to require the use of a trailing comma on multi-line array declarations.
Associated actions include:
a) Modify codechecker in order to provide basic support to the proposal above.
b) Document the change
c) Explicitly, it's NOT required to change all current old-style occurrences in the codebase. We'll follow a progressive approach here (new code and modified code).
And that's all. Options are:
A) We accept the change to require the use of a trailing comma on multi-line array declarations.
B) We continue as we are.
- has a non-specific relationship to
-
CONTRIB-8097 Enforce coding guidelines for trailing comma in multi-line array declaration
-
- Closed
-