You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PSR-12 is in ithe making of creating a style guide for attributes #3688
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
----------------------------------------------------------------------
FOUND1ERRORAFFECTING1LINE
----------------------------------------------------------------------
6 | ERROR | [x] Header blocks must be separated by a single blank
| | line
----------------------------------------------------------------------
PHPCBFCANFIXTHE1MARKEDSNIFFVIOLATIONSAUTOMATICALLY
----------------------------------------------------------------------
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.
I was not able to reproduce this problem on the latest version of PHPCS using the PSR12 standard. Here is the output that I got using a file with the code sample provided here:
❯ bin/phpcs --standard=PSR12 test.php at 17:00:49
Time: 25ms; Memory: 6MB
It seems to me this is a duplicate of #3286, which was closed as fixed. I believe that this issue can be closed.
Activity
jrfnl commentedon May 7, 2023
Related to #3793
rodrigoprimo commentedon Feb 25, 2026
I was not able to reproduce this problem on the latest version of PHPCS using the PSR12 standard. Here is the output that I got using a file with the code sample provided here:
It seems to me this is a duplicate of #3286, which was closed as fixed. I believe that this issue can be closed.