Skip to content

PSR12 4.4 Methods and Functions close braces same line #618

Closed
@junior-paytech

Description

@junior-paytech

Is your feature request related to a problem?

It is related to PHP8 and PSR12 standard

Describe the solution you'd like

As described in PSR12 item 4.4

If a function or method contains no statements or comments (such as an empty no-op implementation or when using constructor property promotion), then the body SHOULD be abbreviated as {} and placed on the same line as the previous symbol, separated by a space. For example:

class Point
{
    public function __construct(private int $x, private int $y) {}
    
    // ...
}
class Point
{
    public function __construct(
      public readonly int $x,
      public readonly int $y,
    ) {}
}

Additional context (optional)

Exists some discussion and "suggestions" in this topic - squizlabs/PHP_CodeSniffer#3291

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions