Skip to content

Generic.Functions.OpeningFunctionBraceBsdAllman removes return type when additional lines are present #3357

@markstory

Description

@markstory

Describe the bug
When a function has a return type and an additional new line between the brace and function signature, phpcbf will remove the return type.

Code sample

<?php

class FormattingBug
{
    public function extraLine(string: $a): void

    {
        // code here.
    }
}

To reproduce
Steps to reproduce the behavior:

  1. Create a file called test.php with the code sample above...
  2. Run phpcbf --standard=PSR12 test.php

phpcbf will update the problematic formatting, however the resulting code looks like:

<?php

class FormattingBug
{
    public function extraLine(string: $a)
    {
        // code here.
    }
}

Expected behavior

Formatting to be updated without removing the return type.

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