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,16 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector\Fixture;

use Rector\Tests\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector\Source\SomeAbstractTestCase;

final class SkipTearDownOverrideTest extends SomeAbstractTestCase
{
protected function tearDown(): void
{
parent::tearDown();
$result = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ protected function setUp(): void
{
$value = 1000;
}

protected function tearDown(): void
{
$value = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ private function shouldSkipClassMethod(ClassMethod $classMethod): bool
}

// skip test setup method override, as rather clutters the code than helps
return $this->isName($classMethod, 'setUp') && $this->parentClassAnalyzer->hasParentCall($classMethod);
return $this->isNames($classMethod, ['setUp', 'tearDown']) && $this->parentClassAnalyzer->hasParentCall($classMethod);
}

private function shouldSkipParentClassMethod(ClassReflection $parentClassReflection, ClassMethod $classMethod): bool
Expand Down