Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.2 | Support readonly classes in 11 sniffs #3826

Merged
merged 11 commits into from
May 18, 2023

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented May 18, 2023

Description

Follow up after PR #3686

PHP 8.2 | Generic/UnnecessaryFinalModifier: allow for readonly classes

Includes unit test.

Generic/UnnecessaryFinalModifier: make the sniff more efficient

No need to token walk the contents of functions as the final keyword cannot be used in them anyway.

PHP 8.2 | PEAR/ClassComment: allow for readonly classes

Includes improving the accuracy of the tokens to skip over.

Includes unit test.

PHP 8.2 | PEAR/FileComment: allow for readonly classes

Includes unit test.

PHP 8.2 | PSR2/ClassDeclaration: allow for readonly classes

Includes unit test.

PHP 8.2 | Squiz/ClassDeclaration: allow for readonly classes

Includes unit test.

PHP 8.2 | Squiz/LowercaseClassKeywords: add support for readonly classes/properties

Includes unit test.

Ref:

PHP 8.2 | Squiz/ClassComment: allow for readonly classes

Includes improving the accuracy of the tokens to skip over.

Includes unit test.

PHP 8.2 | Squiz/DocCommentAlignment: add test for readonly classes

Adjust existing unit test to confirm this is already handled correctly.

PHP 8.2 | Squiz/FileComment: allow for readonly classes

Includes unit test.

PHP 8.1/8.2 | Squiz/InlineComment: allow for readonly classes and properties

Includes unit test.

Suggested changelog entry

Support for readonly classes has been added to the following sniffs:
... list of the above named sniffs ....

Related issues/external references

Ref:

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
    • This change is only breaking for integrators, not for external standards or end-users.
  • Documentation improvement

jrfnl added 11 commits May 18, 2023 10:21
No need to token walk the contents of functions as the `final` keyword cannot be used in them anyway.
Includes improving the accuracy of the tokens to skip over.

Includes unit test.

Ref:
* https://wiki.php.net/rfc/readonly_classes
Includes improving the accuracy of the tokens to skip over.

Includes unit test.

Ref:
* https://wiki.php.net/rfc/readonly_classes
Adjust existing unit test to confirm this is already handled correctly.
@jrfnl
Copy link
Contributor Author

jrfnl commented Dec 8, 2023

FYI: this fix is included in today's PHP_CodeSniffer 3.8.0 release.

As per #3932, development on PHP_CodeSniffer will continue in the PHPCSStandards/PHP_CodeSniffer repository. If you want to stay informed, you may want to start "watching" that repo (or watching releases from that repo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants