dubreuia / intellij-plugin-save-actions

Supports configurable, Eclipse like, save actions, including "organize imports", "reformat code" and "rearrange code".
MIT License
531 stars 101 forks source link

The class constructor refactoring in PHP with PSR 12 #368

Open mavazca opened 3 years ago

mavazca commented 3 years ago

Describe the solution you'd like The class constructor refactoring in PHP with PSR 12:

When the argument list is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them.

Wrong

public function __construct(
    int $id,
    string $name
)
{
    $this->id = $id;
    $this->name = $name;
}

Right

public function __construct(
    int $id,
    string $name
) {
    $this->id = $id;
    $this->name = $name;
}
class ClassName
{
    public function aVeryLongMethodName(
        ClassTypeHint $arg1,
        &$arg2,
        array $arg3 = []
    ) {
        // method body
    }
}

For what product

PhpStorm

ktomk commented 3 years ago

@CelaumMm just seeing your report here. This is likely not an issue with the save-actions plugin, only surfacing in its context. code-reformatting is within PhpStorm itself and you should see the same issue w/o save-actions just by reformatting the code (e.g. due to file changes after the refactoring).

Please try just with reformatting code and if you can still reproduce it, report it in the PhpStorm tracker https://youtrack.jetbrains.com/ . The error than can be fixed which should also make it work with save-actions.