Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Apr 18, 2023

Classes/NewFinalClassConstants: rename the sniff

As final constants can now (also) be used in traits and enums, I propose to remove the Class from the sniff name. The sniff will still be in the Classes category.

As this is a new sniff in PHPCompatibility 10.0.0, this is not a BC-break.

Includes a small tweak to the error message to also remove the class keyword from the message.

Classes/NewFinalConstants: improve message precision

Throw the error on the final keyword instead of the const keyword. This will more clearly indicate the issue when people use the PHPCS code view.

Classes/NewFinalConstants: add tests for constants in PHP 8.1 enums

The sniff already handles this correctly, no functional changes needed.

Classes/NewFinalConstants: add tests for PHP 8.2 constants in traits

The sniff already handles this correctly, no changes needed.

jrfnl added 4 commits April 18, 2023 05:53
As `final` constants can now (also) be used in traits and enums, I propose to remove the `Class` from the sniff name. The sniff will still be in the `Classes` category.

As this is a new sniff in PHPCompatibility 10.0.0, this is not a BC-break.

Includes a small tweak to the error message to also remove the `class` keyword from the message.
Throw the error on the `final` keyword instead of the `const` keyword. This will more clearly indicate the issue when people use the PHPCS `code` view.
The sniff already handles this correctly, no functional changes needed.
The sniff already handles this correctly, no changes needed.
@jrfnl jrfnl added Type: chores/QA PR: quick merge PR only contains relatively simple changes PR: ready for review labels Apr 18, 2023
@jrfnl jrfnl added this to the 10.0.0 milestone Apr 18, 2023
@jrfnl jrfnl requested a review from wimg April 18, 2023 04:22
@wimg wimg merged commit 97dc4a6 into develop Apr 20, 2023
@wimg wimg deleted the feature/classes-new-final-constants-update branch April 20, 2023 13:22
@github-actions github-actions bot removed PR: ready for review PR: quick merge PR only contains relatively simple changes labels Apr 20, 2023
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.

3 participants