- Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
After upgrading to 2.x, I started to see these two use cases, which were not reported by phpcs before:
$this->setFoo(true ? 1 : 2);
$this->setFoo('some' . 'long' . 'text');
These are both considered as "multi-line function calls" and an Indent
as well as CloseBracketLine
errors are reported. The Indent
error is not reported in 1.5.x, so this might be an BC break as well.
I believe that none of these two situations should actually be considered as "multi-line function calls" in the context of PSR2, it states:
Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line. https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md#46-method-and-function-calls
In both these examples there is only one argument given for the called method and the indentation which is introduced is present only to provide better readability (the real world cases are with much longer lines and more complex code, of course). So the indentation which is being checked should be that one of the internal structure of the argument (probably by another sniff), not the structure of the function call itself. The same applies to checking of the closing bracket, because this is actually not an multi-line call.
What do you think about this?