djoos / Symfony-coding-standard

Development repository for the Symfony coding standard
MIT License
402 stars 102 forks source link

phpcs:ignore breaks MultiLineArrayComma if used on last element #175

Closed blastoise365 closed 4 years ago

blastoise365 commented 5 years ago

Initially, I've posted this issue to squizlabs, but it seems that it's related to this repo. (https://github.com/squizlabs/PHP_CodeSniffer/issues/2672)

This code will work fine:

$array = [
    'aaaaa',
    'bbbbb',
];

But this one will report MultiLineArrayComma problem

$array = [
    'aaaaa',
    'bbbbb', // phpcs:ignore
];

My example why I'm using ignore on last element: (I'm getting some results with guzzle and keys in response are not properly named so I'm ignoring camel case on those)

$bot->userStorage()->save([
    'x_task_option_'.$i.'_id' => $taskData->Results[$i]->id, // phpcs:ignore Zend.NamingConventions.ValidVariableName.NotCamelCaps
    'x_task_option_'.$i.'_name' => $taskData->Results[$i]->name, // phpcs:ignore Zend.NamingConventions.ValidVariableName.NotCamelCaps
]);
xalopp commented 5 years ago

@blastoise365 I have created a PR #177. Would be great if you can confirm if it's fix the issue.

blastoise365 commented 4 years ago

@xalopp I can confirm that this is fixing the issue.