laravel / pint

Laravel Pint is an opinionated PHP code style fixer for minimalists.

Home Page:https://laravel.com/docs/pint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pint not fixing spaces inside parenthesis

calebdw opened this issue · comments

  • Pint Version: 1.1.1
  • PHP Version: 8.1.8

Description:

When using the PSR12 preset (or when explicitly setting the no_spaces_inside_parenthesis": true, rule) the spaces inside the parenthesis are not removed for the below code block.

Steps To Reproduce:

Run pint --preset=psr12 <file> on the function below.

    public function article(int $id)
    {
        // ...

        ( new AddRecentlyViewedArticle() )->add($article, auth()->user()->id);

        // ...
    }

It's no_spaces_inside_parenthesis.

https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/50102dc6618413eadec929ec1bdb2b73323c0b36/doc/rules/whitespace/no_spaces_inside_parenthesis.rst

Yes, I made a mistake in the spelling of the fixer in the issue. However, this does not change the fact that 1) it is a default in the PSR12 preset:

@psr12
Using the @PSR12 rule set will enable the no_spaces_inside_parenthesis rule.

and that 2) the example shown is not being fixed, either with the PSR12 preset or with the rule explicitly enabled in the pint.json config.