matthewbdaly / abstract-or-final-sniff

PHP CodeSniffer sniff to find classes not declared as abstract or final
MIT License
4 stars 2 forks source link

Incorrect sniff name after scan #2

Open roslov opened 2 years ago

roslov commented 2 years ago

When I run phpcs --standard=vendor/matthewbdaly/abstract-or-final-sniff/src/AbstractOrFinalClassesOnly/ruleset.xml -p -s src/Entity/CampaignStatus.php I receive such an error:

FILE: /app/src/Entity/CampaignStatus.php
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 40 | ERROR | [x] All classes should be declared using either the "abstract" or "final" keyword
    |       |     (Matthewbdaly.Sniffs.AbstractOrFinal.Matthewbdaly\AbstractOrFinalClassesOnly\Sniffs\AbstractOrFinalSniff)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

What should I change to have the sniff name like AbstractOrFinalClassesOnly but not Matthewbdaly.Sniffs.AbstractOrFinal.Matthewbdaly\AbstractOrFinalClassesOnly\Sniffs\AbstractOrFinalSniff?

matthewbdaly commented 2 years ago

Sorry, I don't know. Codesniffer is rather arcane in that regard, and the documentation is rather hard to follow. Given that:

Then I never really polished it up further than that. To date this is my only Codesniffer rule I've written, so it wasn't really worthwhile digging further to sort out something like that.

If it was being made part of a large coding standard, then it would probably be straightforward to just drop it into one of the existing folders and amend the namespace accordingly, and it'd just work.