2

When I run PHP Code Inspector set to PSR-2 over my PHP code, it always points out that "the closing brace for a class must go on the next line after the body." PhpStorm formats classes like this:

class MyClass 
{

     public function myFunction1()
     {
          // function body goes here
     }

     public function myFunction2()
     {
          // function body goes here
     }

}

According to PSR-2, the class' closing brace should come right after the class body, so it should look like this:

class MyClass 
{

     public function myFunction1()
     {
          // function body goes here
     }

     public function myFunction2()
     {
          // function body goes here
     }
}

Is there a way to tell PhpStorm to do this correctly? I know I can set the maximum blank lines after functions to 0, but this will apply to all functions and look terrible. I only need the blank line after the final function gone. Any ideas?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • Not super sure ... but this one looks the most relevant to me: https://youtrack.jetbrains.com/issue/WI-35475 .. or you can browse for [other tickets](https://youtrack.jetbrains.com/issues/WI?q=%23%7BPHP%20Formatter%7D%20class%20brace) – LazyOne Jun 04 '18 at 08:14

0 Answers0