SonarQube:规则集不尊重PSR

I have a little issue with SonarQube to scan PHP code.

When scanning the work, there is an error coming a hundred times:

Move this open curly brace to the end of the previous line

This apply on this code for example:

class Edit extends Container
{

It shouldn't as PSR are clear on this topic :

  1. Opening braces for classes MUST go on the next line, and closing braces MUST go on the next line after the body.

  2. Opening braces for methods MUST go on the next line, and closing braces MUST go on the next line after the body.

  3. Opening braces for control structures MUST go on the same line, and closing braces MUST go on the next line after the body

When I look in the detail of the error in Sonar, this is what the rule seems to follow, which is not appropriate:

Sharing some coding conventions is a key point to make it possible for a team to efficiently collaborate. This rule make it mandatory to place open curly braces at the end of lines of code.

And there it shows me the example of the if condition

if(...) {
 //...
}

Any idea to follow the proper rule?

Finally I found a solution:

  • edit your project configuration by disabling the faulty rules and enabling the wanted ones, in this case: PSR2. You can also add some additionnal rules, for example in my case, the Magento 2 ones ;
  • to make the changes taken in to account: launch a new build.

Hope it will help other.