Skip to content

Skip StandaloneLinePlainConstructorParamFixer for 3 or fewer params#53

Merged
TomasVotruba merged 1 commit into
mainfrom
skip-short-plain-constructor-params
Jul 20, 2026
Merged

Skip StandaloneLinePlainConstructorParamFixer for 3 or fewer params#53
TomasVotruba merged 1 commit into
mainfrom
skip-short-plain-constructor-params

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

StandaloneLinePlainConstructorParamFixer now only splits constructors with 4 or more parameters. Short parameter lists stay readable on a single line.

Skipped:

final class SkipThreeParams
{
    public function __construct(CorePermissions $security, Translator $translator, RouterInterface $router)
    {
    }
}

Still fixed:

 final class PlainParams
 {
-    public function __construct(CorePermissions $security, Translator $translator, RouterInterface $router, Logger $logger)
+    public function __construct(
+        CorePermissions $security,
+        Translator $translator,
+        RouterInterface $router,
+        Logger $logger
+    )
     {
     }
 }

Param counting ignores tokens nested in default values, so [1, 2] or new Foo(1) defaults do not inflate the count. The previous empty-param-list guard is subsumed by the count check.

@TomasVotruba
TomasVotruba merged commit 772f440 into main Jul 20, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the skip-short-plain-constructor-params branch July 20, 2026 07:46
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