PrivateInFinalClassRule
throws false positive when using PHPUnit attribute #[Before]
#845
Labels
PrivateInFinalClassRule
throws false positive when using PHPUnit attribute #[Before]
#845
I'm happy to implement a solution here, just not sure of the best approach. I think the most precise solution is to check if the $node in PrivateInFinalClass has a Before attribute. Maybe this should be configurable at some point 🤷
Steps required to reproduce the problem
I have a test class written like this:
Expected Result
No warning should be raised from PHPStan.
Actual Result
When running PHPStan with the PrivateInFinalClassRule, it tells me that this method can be private. However, if I convert the error to private, PHPUnit fails because
Error: Call to private method Tests\Feature\Models\UserTest::unguardModels() from scope PHPUnit\Framework\TestCase
.Suggested Change
The text was updated successfully, but these errors were encountered: