Skip to content

PSR-12 is in ithe making of creating a style guide for attributes #3688

@snake-py

Description

@snake-py

Hello,

today I noticed that code sniffer (with psr-12) will throw an error by code like this:

#[AsCommand(name: 'serveDebug')]
class ServeDebug extends ServeCommand

because the current rule seems not to take into account that one line above a class definition can be attributed the output:

FILE: /app/Console/Commands/ServeDebug.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Header blocks must be separated by a single blank
   |       |     line
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

I know that they have not totally settled on a style php-fig/per-coding-style#26

I just wanted to raise awareness, because I am guessing the rule should be changed for php 8 users. I don't see that they will settle on an required additional line between the attribute and the class.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions