search

Home  >  Q&A  >  body text

Prevent PhpStorm from organizing constructor parameters in tabular format

The parameters of my constructor are written on different lines. When I press Ctrl Alt Shift L to format the code, PhpStorm adds spaces to the shorter parameter types so that the columns are equal length.

I can't figure out which code style setting is causing this. I want to disable it.

What it does:

public function __construct(
    AdvertisingDetailsAdapter $advertisingDetailsAdapter,
    AdAccountService          $adAccountService,
    BusinessManagerService    $businessManagerService
)

What I want:

public function __construct(
    AdvertisingDetailsAdapter $advertisingDetailsAdapter,
    AdAccountService $adAccountService,
    BusinessManagerService $businessManagerService
)

P粉113938880P粉113938880315 days ago468

reply all(1)I'll reply

  • P粉099145710

    P粉0991457102024-01-04 10:01:38

    I believe the relevant configuration switches are shown on the picture

    If the image cannot be loaded:

    1. Press Alt F7 to open Settings (or select File => Settings from the main menu)
    2. In the settings dialog, navigate to Editor => Code Style => PHP (from the left pane)
    3. In the right pane, select the Surrounds and Supports tab
    4. Within this tab, uncheck the check mark (check) in Function declaration parameters =>Multiline alignment
    5. reply
      0
  • Cancelreply