When reporting an issue (bug) please provide the following information:
$ php -v):=> php 7.1.13
$ php-cs-fixer -V):=> .PHP CS Fixer 2.10.0
=> fix
=>'braces' => [
'allow_single_line_closure' => true,
'position_after_anonymous_constructs' => 'same',
'position_after_functions_and_oop_constructs' => 'next',
'position_after_control_structures' => 'same',
],
=> private function __construct(
argument 1,
argument 2,
argument 3,
argument 4
)
{
}
=> private function __construct(
argument 1,
argument 2,
argument 3,
argument 4
) {
}
=> private function __construct(
argument 1,
argument 2,
argument 3,
argument 4
)
{
}
I think this is the expected behavior: the fixer was implemented with PSR-2 in mind:
When the argument list is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them.
Maybe the documentation of the fixer should be updated to be more explicit about this. We could also implement a new option to enable the behavior you want, though I'm not a big fan, let's see if more people need it.
Thanks @julienfalque
i've tried something and opened a pull request..! Let's see if my pull request is qualified enough to merge #3677
Although it didn't pass all the checks.
@julienfalque if this is the intended behavior, then the option should be removed.
Because it says clearly "position after functions and oop constructs" and this statement has nothing to do with PSR-2. In fact, I would argue that this fixer handles a superset of PSR-2, as it is supposed (at least as I read it) both versions.
Most helpful comment
@julienfalque if this is the intended behavior, then the option should be removed.
Because it says clearly "position after functions and oop constructs" and this statement has nothing to do with PSR-2. In fact, I would argue that this fixer handles a superset of PSR-2, as it is supposed (at least as I read it) both versions.