Skip to content

Generic.WhiteSpace.ScopeIndent error on multi-line function call with static closure argument #1761

Closed
@hews

Description

@hews

When passing an anonymous function to another function (eg, array_map()), and putting both the called arguments on new lines, Generic.WhiteSpace.ScopeIndent identifies the arguments and correctly allows the following:

array_map(
    function ( $item ) {
        echo $item;
    },
    $some_array
);

However, when using the static keyword on the anonymous function, as in:

 1 | array_map(
 2 |     static function ( $item ) {
 3 |         echo $item;
 4 |     },
 5 |     $some_array
 6 | );

The following error is triggered:

  2 | ERROR | [x] Line indented incorrectly; expected 0 tabs, found 1 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions