docs icon indicating copy to clipboard operation
docs copied to clipboard

Code style summary to discuss and configure

Open arogachev opened this issue 3 years ago • 4 comments

Trailing comma after last argument (if they are split into multiple lines):

$this->assertSame(
    ['' => ['Value must be no less than 5.']],
    $result->getErrorMessagesIndexedByPath(),
);

vs

$this->assertSame(
    ['' => ['Value must be no less than 5.']],
    $result->getErrorMessagesIndexedByPath()
);

The first option is already used for array elements, but not automated.

arogachev avatar Oct 17 '22 09:10 arogachev

I like the first. The same about a function parameters declaration.

roxblnfk avatar Oct 17 '22 09:10 roxblnfk

First one. It's more consistent with arrays:

$array = [
'foo',
'boo',
];

and it easier/more friendly to developer - needs less actions when move last item:

  1. move line

vs

  1. move line,
  2. add comma to moved line
  3. remove comma to actual last line

tomaszkane avatar Oct 17 '22 11:10 tomaszkane

1st way is good to go.

samdark avatar Oct 17 '22 21:10 samdark

https://docs.styleci.io/fixers#trailing_comma_in_multiline_call

arogachev avatar Oct 18 '22 05:10 arogachev