-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Generic/CamelCapsFunctionName: improve code coverage #642
Merged
jrfnl
merged 3 commits into
PHPCSStandards:master
from
rodrigoprimo:test-coverage-camel-caps-function-name
Oct 29, 2024
Merged
Generic/CamelCapsFunctionName: improve code coverage #642
jrfnl
merged 3 commits into
PHPCSStandards:master
from
rodrigoprimo:test-coverage-camel-caps-function-name
Oct 29, 2024
Conversation
This file contains 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
jrfnl
reviewed
Oct 27, 2024
src/Standards/Generic/Sniffs/NamingConventions/CamelCapsFunctionNameSniff.php
Show resolved
Hide resolved
src/Standards/Generic/Sniffs/NamingConventions/CamelCapsFunctionNameSniff.php
Show resolved
Hide resolved
src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.1.inc
Outdated
Show resolved
Hide resolved
rodrigoprimo
force-pushed
the
test-coverage-camel-caps-function-name
branch
from
October 28, 2024 18:38
5a9ee16
to
b73e136
Compare
Thanks for your review, @jrfnl! I just pushed a new commit implementing the changes that you suggested and this PR is ready for a final check. |
* This sniff only listens to `T_FUNCTION`. It does not listen to `T_FN` or `T_CLOSURE`. So the inline code comments were incorrect. The if conditions are still valid to bail early when live coding, but they do not ever apply to closures or arrow functions (anymore - it was possible in the past though). * The inline comments regarding leading underscores was inaccurate as the code removes all leading underscores, not just the first.
Doing this to be able to create tests with syntax errors on separate files.
…essary return The `return;` is unnecessary as the last statement in a method. Test improvements: * Add separate test case files with live coding/parse error tests. * Add tests verifying sand safeguarding that the name of methods in interfaces is also checked. * Add tests covering the public `strict` property which can be toggled from within rulesets.
jrfnl
approved these changes
Oct 29, 2024
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.
@rodrigoprimo All good. Thanks for making those updates.
I'll rebase & squash the fixup commits before merging.
jrfnl
force-pushed
the
test-coverage-camel-caps-function-name
branch
from
October 29, 2024 05:17
b73e136
to
d59edc4
Compare
# for free
to join this conversation on GitHub.
Already have an account?
# 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.
Description
This PR improves code coverage for the
Generic.NamingConventions.CamelCapsFunctionName
sniff and makes the following minor changes to the sniff code:return;
at the end of a method.Related issues/external references
Part of #146
Types of changes
PR checklist