Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method_argument_space: allow separating arguments with empty lines #7849

Open
raveren opened this issue Feb 21, 2024 · 0 comments
Open

method_argument_space: allow separating arguments with empty lines #7849

raveren opened this issue Feb 21, 2024 · 0 comments
Labels
kind/feature request topic/whitespace Indentation, spacing, new lines

Comments

@raveren
Copy link

raveren commented Feb 21, 2024

Feature request

https://cs.symfony.com/doc/rules/function_notation/method_argument_space.html

In method arguments and method call, there MUST NOT be a space before each comma and there MUST be one space after each comma. 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.

This definition allows for empty lines between the two subsequent parameters. Illustrated:

$pageFilters->add(
    Filters\Text::create(/* */),

    Filters\Dropdown::create(
        'user_id',
        /* ... */
    ),

    Filters\Dropdown::create(
        'location_id',
        /* ... */
        /* ... */
        /* ... */
    ),
);

IMHO this is a valid, readable way to format variadic function parameters. It's especially useful for more complex ones as they become visually distinct from each other, and that allows cursory scan of the parameters to quickly find the one you need - or to determine the amount of passed parameters, and their order.

However, there is no existing configuration that would allow that, php-cs-fixer removes the empty lines between Filters definitions:

$pageFilters->add(
    Filters\Text::create(/* */),
    Filters\Dropdown::create(
        'user_id',
        /* ... */
    ),
    Filters\Dropdown::create(
        'location_id',
        /* ... */
        /* ... */
        /* ... */
    ),
);

Thanks for reading and consideration, here's a racoon for your trouble:

                ,,,
             .'    `/\_/\
           .'       <@I@>
<((((((((((  )____(  \./
           \( \(   \(\(
            `-"`-"  " "
@Wirone Wirone added the topic/whitespace Indentation, spacing, new lines label Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature request topic/whitespace Indentation, spacing, new lines
Projects
None yet
Development

No branches or pull requests

2 participants