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

Heredoc containing \n cannot be parsed for indenting #2015

Copy link
Copy link
@karptonite

Description

@karptonite
Issue body actions

Playground link

Input:

<?php
function foo() {
    $message .= <<<EOT
    Please read this message.\n  We apologize for the inconvenience.
    EOT;
}

Output:

Invalid body indentation level (expecting an indentation at least 4) on line 5

  3 |     $message .= <<<EOT
  4 |     Please read this message.\n  We apologize for the inconvenience.
> 5 |     EOT;
    |    ^
  6 | }
  7 |

Expected:

<?php
function foo() {
    $message .= <<<EOT
    Please read this message.\n  We apologize for the inconvenience.
    EOT;
}

Basically, the \n in the middle of the heredoc appears to confuse either the parser or prettier.

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.