Skip to content

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

Merged
merged 1 commit into from
Nov 16, 2019
Merged

Conversation

marcospassos
Copy link
Collaborator

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.

@marcospassos
Copy link
Collaborator Author

@pepakriz can you review it?

@pepakriz
Copy link
Owner

@marcospassos Cool, thank you. I'm gonna merge it.

@marcospassos
Copy link
Collaborator Author

Changes applied :)

@pepakriz pepakriz merged commit 5a2f110 into master Nov 16, 2019
@pepakriz pepakriz deleted the method-whitelisting branch November 16, 2019 18:12
@@ -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/'];
Copy link
Owner

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/']]

Copy link
Collaborator Author

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.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcospassos agree with map

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possibility to exclude tests
2 participants