plugin-php icon indicating copy to clipboard operation
plugin-php copied to clipboard

Symfony #[Route] Formatting Bug

Open TomoyaHamasaki opened this issue 1 year ago • 2 comments

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 avatar May 14 '24 16:05 TomoyaHamasaki

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

cseufert avatar Jun 11 '24 00:06 cseufert

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?

dardandauti avatar Feb 14 '25 09:02 dardandauti