Skip to content

Space between "return" and parenthesis gets removed unconditionally #509

@markkirchner

Description

@markkirchner

Example:

class Foo
{
    public function bar(int $v = 0): int
    {
        return ($v > 0) ? $v : -42;
    }
}

Problem:
When running the formatter on this, the space between return and the parenthesis always gets removed. This seems to happen regardless of the selected Code Style setting and I could not find a specific formatting rule / overwrite that has any impact on this.

Note:
I know that the parenthesis around the $v > 0 condition are not strictly necessary. And when removing them, everything works as expected.
Still, the formatter should not chose to modify the spacing just because those parens are there.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions