squizlabs / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
10.66k stars 1.48k forks source link

PHP 8.2 | Support readonly classes in 11 sniffs #3826

Closed jrfnl closed 1 year ago

jrfnl commented 1 year ago

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

jrfnl commented 9 months ago

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).