Skip to content

Symfony #[Route] Formatting Bug #2360

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

Open
TomoyaHamasaki opened this issue May 14, 2024 · 2 comments · May be fixed by #2424
Open

Symfony #[Route] Formatting Bug #2360

TomoyaHamasaki opened this issue May 14, 2024 · 2 comments · May be fixed by #2424

Comments

@TomoyaHamasaki
Copy link

TomoyaHamasaki commented May 14, 2024

The formatting of #[Route] lines are broken, I think. It tends to spread out over multiple lines when it could neatly fit into just one.

Input

#[Route('route/path', name: 'very_very_very_very_very_very_long_route_name', methods: ['GET'])]

Output

#[
    Route('
        'route/path',
        name: 'very_very_very_very_very_very_long_route_name',
        methods: ['GET']
    )
]
@TomoyaHamasaki TomoyaHamasaki changed the title Breaks #[Route] lines in Symfony #[Route] lines in Symfony Format Bug May 15, 2024
@TomoyaHamasaki TomoyaHamasaki changed the title #[Route] lines in Symfony Format Bug Symfony #[Route] Formatting Bug May 15, 2024
@cseufert
Copy link
Collaborator

cseufert commented Jun 11, 2024

Following PER CS 2.0 we should never have a line break after #[ and before the closing ]

@dardandauti
Copy link

Made a similar discovery. If you haven't resolved it already, maybe it looks like that since the print width is defaulted to 80 characters. Your line seems to be 95 characters long which is why prettier would format it that way?

@apollisa apollisa linked a pull request May 2, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants