driade / phpfmt8

PHP formatter for Sublime Text 4, with PHP 8 support.
BSD 3-Clause "New" or "Revised" License
45 stars 2 forks source link

Problems with curly braces in some cases #70

Closed reprintsev closed 6 months ago

reprintsev commented 7 months ago

Here is a sample code that, when formatted with default settings, does not change in any way.

<?php
// case 1
if (true) {return;}

// case 2
if (true) {return;
}

// case 3
if (true) {
    return;}

I believe that for case 1 this is OK.

And for cases 2 and 3 the result should be like this?

<?php
// case 2, 3
if (true) {
    return;
}
driade commented 7 months ago

Hi. This is already coded on my machine, and I'm working with this change in my daily basis to check it works.

This change carries greater impact than meets the eye. We've implemented a new rule to ensure consistency in code formatting. Now, if an opening brace is followed by a new line, the corresponding closing brace must also be on a new line. And the other way around.

This adjustment aims to enhance readability and maintain uniformity across our codebase.

driade commented 6 months ago

Hi! This should be fixed in the latest release. It may take a few hours. Thanks!