Skip to content

Add StandaloneLinePlainConstructorParamFixer to spaces set#52

Merged
TomasVotruba merged 1 commit into
mainfrom
standalone-line-plain-constructor-param
Jul 19, 2026
Merged

Add StandaloneLinePlainConstructorParamFixer to spaces set#52
TomasVotruba merged 1 commit into
mainfrom
standalone-line-plain-constructor-param

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Constructors with plain (non-promoted) params were not covered by any set rule. StandaloneLinePromotedPropertyFixer only fires when a promoted property is present, and StandaloneLineConstructorParamFixer is registered as conflicting with it, so it cannot be added to the same set.

This adds StandaloneLinePlainConstructorParamFixer, which handles exactly the gap: constructors that have params and no promoted properties. The two rules never touch the same constructor, so both live in the spaces set.

 final class LeadController
 {
-    public function __construct(CorePermissions $security, Translator $translator, RouterInterface $router, FormFactoryInterface $formFactory)
+    public function __construct(
+        CorePermissions $security,
+        Translator $translator,
+        RouterInterface $router,
+        FormFactoryInterface $formFactory
+    )
     {
     }
 }

One param per line keeps a new or removed dependency down to a single-line diff.

Skipped:

  • constructors with promoted properties (handled by StandaloneLinePromotedPropertyFixer)
  • empty param list
  • any method other than __construct

Registered in SpacesLevel::RULES next to its sibling standalone-line rules, so it ships with the spaces set and withSpacesLevel().

Applying the rule to this repo reformatted one constructor in TokenNotFoundException.

@TomasVotruba
TomasVotruba merged commit ce1625c into main Jul 19, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the standalone-line-plain-constructor-param branch July 19, 2026 22:43
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