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

some rules with psr-12 preset seems incorrect

mirzazeyrek opened this issue · comments

  • Pint Version: 0.2.3
  • PHP Version: 8.0.17

Description:

psr-12 preset is using incorrect if block structure with exclamation mark.

Steps To Reproduce:

run the linter with an if statement with exclamation mark.

1-
-            if (!empty($toRemove)) {

2-
+            if (! empty($toRemove)) {

also with docblocks:

1-
@param string $id
to
2-
@param  string  $id

and
1-
@param $id
to
2-
@param    $id

I would say 1st examples supposed to be correct or am I missing something here ?

another issue is the removal of spaces before and after the . is half compliant with PSR-12
as it only recoomends to do it the same throughout the project -> and we used to use " . " and not "." what is it converted to now:
https://stackoverflow.com/a/66033448/1194797
https://xoops.gitbook.io/xoops-modules-cookbook/coding-standards/standards/styleguide#concatenation

-                echo "Usage:" . PHP_EOL;
+                echo 'Usage:'.PHP_EOL;

thanks in advance.

The code snippet you suggested on the "docblocks" tells me that you are using the Laravel preset. Can you double check that?

Thanks for looking into that. I'm pretty sure we are using psr12 preset. You can also try it locally by copy pasting the examples I mentioned:

image

@mirzazeyrek Can you share the full console output please?

I will re-open this issue once you share the console output.