Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Wrong indentation in match statements with multiple options #2435

Copy link
Copy link
@Triqueon

Description

@Triqueon
Issue body actions

@prettier/plugin-php v0.22.4
Playground link

Input:

<?php

echo match ($operation) {
      "short", "really very long option 2" => SomeClass::fairlyLongMethodNameThatRunsOn($variable, ["short", "short"]),
}

Output:

<?php

echo match ($operation) {
    "short",
    "really very long option 2"
        => SomeClass::fairlyLongMethodNameThatRunsOn($variable, [
        "short",
        "short",
    ]),
};

As you can see, the indentation in the output is off. There's arguments for each individual line being ok, but at the very least, the array entries should by indented one more than their braces (now: same as opening, 1 more than closing), and the closing brace for the array should be indented as much as the line with the opening brace.

As far as I can tell, the length of the individual parts is irrelevant, only that they are in total long enough for a line break to be forced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.