Skip to content

Add standaloneLine set and Symfony attribute param fixer#56

Merged
TomasVotruba merged 1 commit into
mainfrom
standalone-line-symfony-attribute-set
Jul 22, 2026
Merged

Add standaloneLine set and Symfony attribute param fixer#56
TomasVotruba merged 1 commit into
mainfrom
standalone-line-symfony-attribute-set

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Standalone-line Symfony attribute fixer + standaloneLine set

New fixer: StandaloneLineSymfonyAttributeParamFixer

Breaks each argument of a Symfony attribute onto its own line (detection: the written attribute name contains the Symfony namespace part). Third-party attributes keep their layout.

-#[\Symfony\Component\Console\Attribute\AsCommand(name: 'mautic:entity:import', description: 'Import entity data from a ZIP file.')]
+#[\Symfony\Component\Console\Attribute\AsCommand(
+    name: 'mautic:entity:import',
+    description: 'Import entity data from a ZIP file.'
+)]
 final class SomeCommand
 {
 }

Skipped: attributes without arguments (#[\Override]), empty argument lists, and non-Symfony attributes (e.g. #[\Doctrine\ORM\Mapping\Table(...)]).

New standaloneLine set

Opt-in set grouping the standalone-line rules:

  • StandaloneLineSymfonyAttributeParamFixer (new)
  • StandaloneLinePromotedPropertyFixer
  • StandaloneLinePlainConstructorParamFixer
  • StandaloneLineRequiredParamFixer

Usage:

$ecsConfig->withPreparedSets(standaloneLine: true);
// or
$ecsConfig->withSets([SetList::STANDALONE_LINE]);

Wired via SetList::STANDALONE_LINE and a new withPreparedSets(standaloneLine: ...) flag. Not part of the common aggregate — enable explicitly.

Moved rule

StandaloneLinePlainConstructorParamFixer removed from the spaces set (SpacesLevel::RULES); it now lives in the new standaloneLine set.

Add a fixer that breaks each argument of a Symfony attribute onto its own
line, and a new opt-in "standaloneLine" set grouping the standalone-line
constructor, promoted property, required param and attribute fixers.

Move StandaloneLinePlainConstructorParamFixer out of the spaces set into
the new standaloneLine set.
@TomasVotruba
TomasVotruba merged commit 80f7c0c into main Jul 22, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the standalone-line-symfony-attribute-set branch July 22, 2026 13:26
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