When applying array_indentation and method_chaining_indentation rules, PHP CS Fixer needs to run twice:
first run:
function foo($foo)
{
$foo
->bar()
- ->baz([
+ ->baz([
'foo' => 'bar',
])
;
}
second run:
function foo($foo)
{
$foo
->bar()
->baz([
- 'foo' => 'bar',
- ])
+ 'foo' => 'bar',
+ ])
;
}
This seems to be a regression in version 1.13.2 as version 1.13.1 applies all changes at first run.
I think this is caused by #4084 (sorry 馃槣) where method_chaining_indentation got a priority, which is actually the same as array_indentation. I think in your case array_indentation runs first, whereas method_chaining_indentation seems to need to run first.
However, this might produce issues when you are chaining _inside_ an array. I do think your situation is more common though, so the solution is to either give method_chaining_indentation a +1 or array_indentation a -1. (And of course couple the priority, with given example as testcase.)
The lowest version this applies to is 2.12.5
As I was the culprit, I created PR #4276 to fix my boo-boo 馃槄
Most helpful comment
As I was the culprit, I created PR #4276 to fix my boo-boo 馃槄