-
Notifications
You must be signed in to change notification settings - Fork 10
Add support for method whitelisting #93
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
Conversation
@pepakriz can you review it? |
@marcospassos Cool, thank you. I'm gonna merge it. |
6a2c0e4
to
b3029fc
Compare
Changes applied :) |
@@ -161,4 +168,10 @@ public function testThrowsInGlobalScope(): void | |||
$this->analyse(__DIR__ . '/data/throws-in-global-scope.php'); | |||
} | |||
|
|||
public function testMethodWhitelist(): void | |||
{ | |||
$this->methodWhitelist = [TestCase::class => '/^test/']; |
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.
@marcospassos Inconsistent structure. If I follow readme it should be [TestCase::class => ['/^test/']]
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.
My fault, it's supposed to be a map of class names and patterns as key-value pairs. I don't see a significant advantage in supporting multiples patterns per class, and it brings performance penalties. It's better to combine multiples patterns into a single one.
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.
@marcospassos agree with map
Fixes #24
A new
methodWhitelist
option allows specifying classes and patterns as key-value pairs for matching methods which does not require@throws
annotations to be specified.