Merged
Conversation
As the PHPCS native autoloader can run into trouble when one sniff extends another sniff and both sniffs are used within the same standard, all sniffs ought to be declared as `final`. When inheritance or re-use of logic is needed for a sniff, use an abstract base class or a helper trait instead. Note: this is a breaking change for any standard which would happen to be extending any of the PHPCompatibility sniffs and should be marked as such in the changelog. Any "bug" reports regarding this change, should advise users to detail the reason for extending the class and should advise users on what to do based on their usecase (send in PR to this repo to add a feature, instantiate the PHPCompatibility sniff within their own sniff, extend one of the abstract classes instead, use a helper trait etc). The change to the PHPCompatibility classes, however, should not be undone. This commit adjusts all public facing classes which existed prior to PHPCompatibility 10.0 (as they need a changelog entry).
As the PHPCS native autoloader can run into trouble when one sniff extends another sniff and both sniffs are used within the same standard, all sniffs ought to be declared as `final`. When inheritance or re-use of logic is needed for a sniff, use an abstract base class or a helper trait instead. Note: this is a breaking change for any standard which would happen to be extending any of the PHPCompatibility sniffs and should be marked as such in the changelog. Any "bug" reports regarding this change, should advise users to detail the reason for extending the class and should advise users on what to do based on their usecase (send in PR to this repo to add a feature, instantiate the PHPCompatibility sniff within their own sniff, extend one of the abstract classes instead, use a helper trait etc). The change to the PHPCompatibility classes, however, should not be undone. This commit adjusts all public facing classes which are new in PHPCompatibility 10.0.
As the PHPCS native autoloader can run into trouble when one sniff extends another sniff and both sniffs are used within the same standard, all sniffs ought to be declared as `final`. When inheritance or re-use of logic is needed for a sniff, use an abstract base class or a helper trait instead. Note: this is a breaking change for any standard which would happen to be extending any of the PHPCompatibility sniffs and should be marked as such in the changelog. Any "bug" reports regarding this change, should advise users to detail the reason for extending the class and should advise users on what to do based on their usecase (send in PR to this repo to add a feature, instantiate the PHPCompatibility sniff within their own sniff, extend one of the abstract classes instead, use a helper trait etc). The change to the PHPCompatibility classes, however, should not be undone. This commit adjusts all test classes.
ad008d2 to
d4a6c42
Compare
wimg
approved these changes
Sep 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As the PHPCS native autoloader can run into trouble when one sniff extends another sniff and both sniffs are used within the same standard, all sniffs ought to be declared as
final.When inheritance or re-use of logic is needed for a sniff, use an abstract base class or a helper trait instead.
👉🏻 Note: this is a breaking change for any standard which would happen to be extending any of the PHPCompatibility sniffs and should be marked as such in the changelog.
Any "bug" reports regarding this change, should require users to detail the reason for extending the class and should advise users on what to do based on their usecase (send in PR to this repo to add a feature, instantiate the PHPCompatibility sniff within their own sniff, extend one of the abstract classes instead, use a helper trait etc).
The change to the PHPCompatibility classes, however, should not be undone.
CS/QA: make all classes final [1]
This commit adjusts all public facing classes which existed prior to PHPCompatibility 10.0 (as they need a changelog entry).
CS/QA: make all classes final [2]
This commit adjusts all public facing classes which are new in PHPCompatibility 10.0 (no changelog entry needed).
CS/QA: make all classes final [3]
This commit adjusts all test classes.