-
-
Notifications
You must be signed in to change notification settings - Fork 73
Generic/UnnecessaryFinalModifier: improve code coverage #241
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
Generic/UnnecessaryFinalModifier: improve code coverage #241
Conversation
6cab32b
to
93c83e3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR @rodrigoprimo !
I considered adding more tests with different class definitions, but I was not able to think of examples that felt relevant enough and also different enough from the tests that are already in place.
What about adding some tests with final
class constants as allowed since PHP 8.1 ?
Thanks for the review, @jrfnl!
Good point, I just pushed a new commit adding tests with final class constants. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding those extra tests @rodrigoprimo !
Doing this to be able to create a test with a syntax error on a separate file.
This commit add one more test case file to exercise defensive code that makes the sniff bail early if the class has no body.
d1c0413
to
d09b571
Compare
Description
This PR improves the code coverage of the Generic.CodeAnalysis.UnnecessaryFinalModifier sniff. There was only one line that was not already exercised by the tests that bails early if it finds a class without a body.
I considered adding more tests with different class definitions, but I was not able to think of examples that felt relevant enough and also different enough from the tests that are already in place.
Related issues/external references
Part of #146
Types of changes
PR checklist