Closed rikvdh closed 3 months ago
This was previously discussed in https://github.com/squizlabs/PHP_CodeSniffer/issues/3200 and I don't think anything has changed in PSR12 since that discussion.
There is now in PER 2.0 a clear example which is then 'wrong'. I've submitted a proposal to fix this in the spec.
@rikvdh As the PR to PER has been merged now, do you agree we can close this issue ?
Yes, could be closed now.
Describe the bug
Found while developing tests for PER2.0, I got the error:
PSR12.Classes.AnonClassDeclaration.SpaceAfterKeyword
, but when diving into specifications for PSR-12, I could not found anything related to spacing being required there.Code sample
Here an error is raised about needing a space between the arguments for the class and the first opening-parenthesis. But nowhere in the specification, nor the errata, I can find on required spacing after class keywords.
What it should be is a bit ambiguous, but when it is not specified it should not be checked. It is 'class instantiation' and should require parentheses. But the space there should not be checked imo.
Custom ruleset
N/A
Expected behavior
I think we need to mute this error.
Please confirm
master
branch of PHP_CodeSniffer.