Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Auto-indent issues - square brackets, function arguments, heredoc/nowdoc #63

Open
@crantok

Description

@crantok

Is this the right place to ask about indenting issues that I am experiencing when editing PHP? Or is auto indenting actually handled by a different module?

The first two examples have very obvious work-arounds and are just annoying. The heredoc issue requires any heredoc strings to be revisited every time anyone auto-indents the whole file.

Indenting square-bracket array syntax over multiple lines only works with a trailing coma, so this works:

class Foo
{
    function bar ()
    {
        return
        [
            [
                // stuff
            ],
            [
                // more stuff
            ],
        ];
    }
}

But this does not:

class Foo
{
    function bar ()
    {
        return
        [
            [
                // stuff
            ],
            [
                // more stuff
                ]
            ];
        }
    }   

Indenting a multi-line function call only works if the closing parenthesis is on the same line as the final parameter, so this works:

class Foo
{
    function bar ()
    {
        foobar(
        extremely_long_and_tedious_variable_name_1,
        extremely_long_and_tedious_variable_name_2,
        extremely_long_and_tedious_variable_name_3 );
    }
}

But this does not:

class Foo
{
    function bar ()
    {
        foobar(
        extremely_long_and_tedious_variable_name_1,
        extremely_long_and_tedious_variable_name_2,
        extremely_long_and_tedious_variable_name_3
    );
}
}

And finally, heredoc and nowdoc syntax are both broken by auto-indent:

class Foo
{
    function bar ()
    {
        return
        <<<'HTML'
        <blockquote>Somthing pithy</blockquote>
        HTML
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions