vscode-phpfmt icon indicating copy to clipboard operation
vscode-phpfmt copied to clipboard

Invalid indent when exclude AddMissingCurlyBraces

Open BergenSoft opened this issue 7 months ago • 3 comments

I have this phpfmt settings:

"phpfmt.exclude": [
    "AddMissingCurlyBraces"
]

And I want to format this code:

if ($a == null)
  $a = 1;

Expected result:

if ($a == null)
    $a = 1;

Actual result:

if ($a == null)
$a = 1;

The indentation is always on the same level like the if statement.

BergenSoft avatar May 14 '25 08:05 BergenSoft

Thanks, I'll take a look.

driade avatar May 15 '25 07:05 driade

Hi again @BergenSoft

There’s no PSR rule that requires the code to be formatted this way. Therefore, enforcing it would introduce a breaking change.

driade avatar Jun 15 '25 14:06 driade

Thanks for your feedback. From my point of view that is a valid bug, because I can have a setting which is causing a wrong indentation. But it is ok for me, I'll look for another formatter. Thank you for your time.

BergenSoft avatar Jun 25 '25 06:06 BergenSoft