Skip to content

Issue with .editorconfig ij_php_blank_lines_around_method #818

Description

@Spriz

Hi! Whenever I enabled the "PHP" extension, my code started formatting weirdly, and the only connecting link I can find is the ij_php_blank_lines_around_method = 1 in .editorconfig - but I'm unsure if this extension really should read this? I can't find anything about it in the docs.

With all default VSCode settings and this PHP as input:

Input

<?php

function foo()
{
    $doubled = array_map(
        fn(int $number) => $number * 2,
        [1, 2, 3],
    );
}
function bar($id)
{
    $doubled = array_map(
        fn(int $number) => $number * 2,
        [1, 2, 3],
    );
}

What I got from formatting the code

<?php

function foo()
{
    $doubled = array_map(

        fn(int $number) => $number * 2,
        [1, 2, 3],
    );
}

function bar($id)
{
    $doubled = array_map(

        fn(int $number) => $number * 2,
        [1, 2, 3],
    );
}

Expected output

<?php

function foo()
{
    $doubled = array_map(
        fn(int $number) => $number * 2,
        [1, 2, 3],
    );
}

function bar($id)
{
    $doubled = array_map(
        fn(int $number) => $number * 2,
        [1, 2, 3],
    );
}

TLDR:

I would not expect it to create a blank line before the anonymous function - but the line only between the 2 function declarations.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions