Skip to content

[BUG] Please remove Unnecessary Parenthesis like Foo; #2454

Description

@lightla

**Prettier 3.8.1 (lastest) **
PHP Plugin 0.24.0

# Options (if any):
--php-version 8.3
--single-quote

Input:

// TRUE
echo (match ('option1') {
    'option1' => fn() => 'First',
    'option2' => fn() => 'Second',
})();


// code snippet
$x = new Foo; // True style
$y = new Foo(1); // True style
$z = (new Foo)->value; // True style

Output:

// ERROR
echo match ('option1') {
    'option1' => fn() => 'First',
    'option2' => fn() => 'Second',
}();


$x = new Foo(); // False sytle: I don't want add ()
$y = new Foo(1); // True style
$z = (new Foo())->value; // False style: I don't want add ()

Expected behavior:

I dont want add unnecessary parenthesis

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions