-
-
Notifications
You must be signed in to change notification settings - Fork 170
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
MethodSignatureSniffs: Add included and exluded patters #854
Conversation
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, nice addition.
I've requested some changes. All requests are valid for more commits :)
Please use rebase and fix errors in the right commits.
SlevomatCodingStandard/Sniffs/Classes/RequireSingleLineMethodSignatureSniff.php
Outdated
Show resolved
Hide resolved
SlevomatCodingStandard/Sniffs/Classes/RequireSingleLineMethodSignatureSniff.php
Outdated
Show resolved
Hide resolved
@@ -392,6 +392,8 @@ Sniff provides the following settings: | |||
|
|||
* `includedMethodPatterns`: allows to configure which methods are included in sniff detection. This is an array of regular expressions (PCRE) with delimiters. | |||
|
|||
* `excludedMethodPatterns`: allows to configure which methods are excluded from sniff detection. This is an array of regular expressions (PCRE) with delimiters. | |||
|
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.
Please document how it works when you set both options together.
SlevomatCodingStandard/Sniffs/Classes/RequireSingleLineMethodSignatureSniff.php
Outdated
Show resolved
Hide resolved
SlevomatCodingStandard/Sniffs/Classes/RequireSingleLineMethodSignatureSniff.php
Show resolved
Hide resolved
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.
-
Please remove the commit with readme and change readme in previous four commits when you add relevant option.
-
Please update all patterns in tests.
/__construct(.*)/
does not make sense now.
@kukulich |
Now you check only method names. |
Thanks. |
Hey.
I added
includedMethodPatterns
andexcludedMethodPatterns
property forRequireSingleLineMethodSignatureSniff
andRequireMultiLineMethodSignatureSniff
includedMethodPatterns:
It will allow you to set methods which you would like to check by these two sniffs
excludedMethodPatterns:
It will allow you to set methods which you would like to ignore by these two sniffs
Sometimes it is good to enforce
RequireMultiLineMethodSignatureSniff
just for one method, for example__construct
.Another benefit of this change is that you are able to use these two sniffs together.
It will force
RequireMultiLineMethodSignature
for__construct
andRequireSignleLineMethodSignature
for all other methods.There is no BC break. If you don't set
excludedMethodPatterns
andincludedMethodPatterns
it will works as before.