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

First class callable syntax treated like arguments, trailing comma causes error #2149

Open
MasonD opened this issue Feb 16, 2023 · 1 comment
Labels

Comments

@MasonD
Copy link

MasonD commented Feb 16, 2023

@prettier/plugin-php v0.19.3
Playground link

Input:

<?php

 return $this->longMethodName(
        
          
                $this->longPropertyName->evenLongerMethodNameNowCausesTheDotsToWrapWithComma(...),
              
        );

Output:

<?php

return $this->longMethodName(
    $this->longPropertyName->evenLongerMethodNameNowCausesTheDotsToWrapWithComma(
        ...,
    ),
);

Expected Output:
No trailing comma after ... in first class callable syntax, which is a syntax error. Or preferentially treating the (...) as being inseparable and not allowing line breaks inside it.

@cseufert cseufert added the bug label Mar 19, 2023
@Spice-King
Copy link

Yea, just bumped into this one myself, extracted a Laravel query filter to a named function for reuse, and a deep/long relation name caused it to break to a new line. Would agree that func(...) should be an unbreakable unit of syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants