When creating a test that has a setup method that never returns (e.g. because the whole test should be skipped), PHPStan will complain that the parent::setUp() should be called.
In this case, we have to choose between either setting up the parent before we skip the test (doing useless work in the process), setting up the parent after the skip, which will trigger an error about dead code, or baselining the original error. All of these solutions seem wrong to me and I think in this PHPStan just shouldn't tell you to call the parent.
Example:
final class MyTest extends TestCase
{
protected function setUp(): never
{
self::markTestSkipped('Currently broken due to XYZ');
}
}
When creating a test that has a setup method that never returns (e.g. because the whole test should be skipped), PHPStan will complain that the
parent::setUp()should be called.In this case, we have to choose between either setting up the parent before we skip the test (doing useless work in the process), setting up the parent after the skip, which will trigger an error about dead code, or baselining the original error. All of these solutions seem wrong to me and I think in this PHPStan just shouldn't tell you to call the parent.
Example: