Hey, thanks for the amazing work!

After declaring a multi-line parameter abstract method, the formatter removes the blank line between the abstract method and the next one and, besides this, it places the opening brace of the next method after abstract one to same line of it's closing parenthesis. Probably because abstract methods have no braces and is my declaration is using multi-line parameters.

Before saving:

After saving:

Thank you one more time!

    Hello Eric,

    Thank you for the feedback. We are going to take a look at the blank line removal.

    About the opening brace, we have a setting for this ( docs ) or it should come from the formatting style you are using php.format.codeStyle. Do you have either of those setup (The default code style is PSR-12)?

    Thank you

      Hi, sorry for the delayed reply. Busy days...
      So, I use default formatting options (PSR-12).
      About the opening brace. It only goes to the same line if the previous method is an abstract method with multi-line parameter declaration.
      My guess for this issue is: In PSR-12, when a method uses multi-line parameter declaration, the opening brace stays in the same line as the closing parenthesis for parameter declaration:

      public function m1(
      string $p1,
      string $p2
      ): bool {
      // my code goes here
      }
      
      public function m2(string $p1): bool
      {
      // my code goes here
      }

      But, when "m1" method is abstract it has no braces, so the next opening brace is the one from the next method.

      I think that, maybe, the formatter algorithm is checking:

      if "this method has multiline parameter declaration", then the next opening brace must be in the same line as the closing parenthesis that's before it.

      Sorry if I'm not making myself clear.

        Hello Erick,

        Thank you, we're able to reproduce so the will be fixed in the next pre-release.

        Thank you!

          Fixed. It will be available in the upcoming pre-release.

          Thanks again!

            Write a Reply...