pretty-php icon indicating copy to clipboard operation
pretty-php copied to clipboard

Consider changes to code style inspired by review of PHP Parser test fixtures

Open lkrms opened this issue 1 year ago • 0 comments

  • [ ] Don't move comments to the other side of empty statements?

  • [ ] Relax enforcement of class attributes on their own line when the class is a one-line and/or anonymous class?

  • [ ] Expand this

    <?php
    [
        $foo,,,
        $bar,
        $baz,
    ] = $data;
    

    to this?

    <?php
    [
        $foo,
        ,
        ,
        $bar,
        $baz,
    ] = $data;
    
  • [ ] Improve tag indentation in this scenario:

    <?php
    function test() {
        ?>
    Test
        <?php
    }
    
  • [x] ~~Suppress .0 in floats with an exponent, e.g. 3.0e5?~~

  • [x] Remove leading space from & in fn &() => null for consistency with fn() => null

  • [x] Check formatting of declare blocks without braces

  • [x] Review switch indentation? e.g.

    <?php
    switch ($a) {
        case 0:
            break;
            // Deindent this after `break`/`return`/`throw`?
        case 1:
        default:
            break;
    }
    
  • [x] Handle leading semicolons in switches

    <?php
    switch ($a) {
            ;
    }
    

lkrms avatar Jan 21 '25 03:01 lkrms