Closed Jean85 closed 6 years ago
Do you have BaseTestCase::fail
in early terminathing method calls? Check out https://github.com/phpstan/phpstan#custom-early-terminating-method-calls.
I'm using PHPUnit\Framework\TestCase::fail()
, I didn't implement myself; I've just copied the implementation inside the code snippet, apart from the fact that I replaced the exception with a generic one, the original method uses PHPUnit\Framework\AssertionFailedError
.
That would be a nice workaround, but I think it should be on this lib to do that normally.
Yeah, I was giving you advice based on the snippet you posted 😊
The config is there if you install the extension: https://github.com/phpstan/phpstan-phpunit/blob/master/extension.neon#L4
Wops, my bad, I forgot to require the configuration! Sorry for wasting your time.
Summary of a problem or a feature request
I'm using PHPStan 0.10.3. I have a small helper method in my base test case to fetch file contents without upsetting the PHPStan analysis. If I write the helper method in the first way (
testMethodOne
in the code snippet) it gets flagged, if I reverse the boolean logic of the guard (testMethodTwo
), it's fine. It should be fine either way!Code snippet that reproduces the problem
https://phpstan.org/r/23fff8faf435e4b9f6561c5857c1b2e2
Expected output
No errors.