laravel / pint

Laravel Pint is an opinionated PHP code style fixer for minimalists.
https://laravel.com/docs/pint
MIT License
2.75k stars 138 forks source link

More consistent class parentheses in Laravel preset #284

Closed brdv closed 1 month ago

brdv commented 1 month ago

Been using Pint for awhile now and very happy with it! The ease of use is very nice.

One (minor) thing I noticed yesterday is the fact that the Laravel preset does not have a strong opinion on parentheses when instantiating new classes. I.e.:

new class; // this is fine

new class(); // also fine

I'm not sure what standards Laravel does or does not follow, but PSR-12 does make parentheses mandatory. Is it possible to include a more opinionated way of instantiating classes? I do not really care which of the two it will be, as long as it's consistent!

In case I'm missing some documentation that explains the decisions made in the Laravel preset, please let me know! I have not found that myself yet.

Note: I know I can add the rule myself, but we'd like to keep custom rules to a minimum. I thought this would be something that should be decided within the preset.

Ps. happy to open a PR myself if you're okay with it!

driesvints commented 1 month ago

I don't think we have a strong opinion on this one right now. We usually remove the parentheses ourselves. You can always attempt a PR 👍