Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Rector\PHPUnit\Tests\CodeQuality\Rector\ClassMethod\NoSetupWithParentCallOverrideRector\Fixture;

use PHPUnit\Framework\TestCase;

final class CoverTearDown extends TestCase
{
#[\Override]
protected function tearDown(): void
{
parent::tearDown();

$some = 'value';
}
}

?>
-----
<?php

namespace Rector\PHPUnit\Tests\CodeQuality\Rector\ClassMethod\NoSetupWithParentCallOverrideRector\Fixture;

use PHPUnit\Framework\TestCase;

final class CoverTearDown extends TestCase
{
protected function tearDown(): void
{
parent::tearDown();
$some = 'value';
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
'Remove override, if setUp() references parent::setUp() call to improve readability',
'Remove override attribute, if setUp()/tearDown() references parent call to improve readability',
[
new CodeSample(
<<<'CODE_SAMPLE'
Expand Down Expand Up @@ -82,7 +82,7 @@ public function refactor(Node $node): ?Node
return null;
}

if (! $this->isName($node, 'setUp')) {
if (! $this->isNames($node, ['setUp', 'tearDown'])) {
return null;
}

Expand Down