Skip to content

Break AsCommand always, other Symfony attributes only with 2+ arguments#61

Merged
TomasVotruba merged 1 commit into
mainfrom
as-command-always-others-multi-arg
Jul 22, 2026
Merged

Break AsCommand always, other Symfony attributes only with 2+ arguments#61
TomasVotruba merged 1 commit into
mainfrom
as-command-always-others-multi-arg

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

#[AsCommand] always breaks its arguments onto standalone lines. Every other Symfony attribute now only breaks when it has 2 or more arguments — a single-argument attribute keeps its compact one-line form.

Before / After

#[AsCommand] — always broken, even with a single argument:

-#[\Symfony\Component\Console\Attribute\AsCommand(name: 'app:some')]
+#[\Symfony\Component\Console\Attribute\AsCommand(
+    name: 'app:some'
+)]
 final class SomeCommand
 {
 }

Other attributes with a single argument — left untouched:

// stays on one line
#[Route(path: '/some')]
public function __invoke()
{
}

Other attributes with 2+ arguments — still broken as before:

-#[Route(path: '/some', name: 'some_route')]
+#[Route(
+    path: '/some',
+    name: 'some_route'
+)]
 public function __invoke()
 {
 }

Argument counting tracks nesting depth, so commas inside a nested array/call of a single argument do not count as extra arguments:

// single argument, stays on one line
#[Autowire(value: ['first', 'second', 'third'])]

…ts in StandaloneLineSymfonyAttributeParamFixer
@TomasVotruba
TomasVotruba merged commit 28e9518 into main Jul 22, 2026
7 checks passed
@TomasVotruba
TomasVotruba deleted the as-command-always-others-multi-arg branch July 22, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant