diff --git a/rules/php-spec-to-phpunit/src/Rector/MethodCall/PhpSpecPromisesToPHPUnitAssertRector.php b/rules/php-spec-to-phpunit/src/Rector/MethodCall/PhpSpecPromisesToPHPUnitAssertRector.php index 5feee1c5417..708993d68b8 100644 --- a/rules/php-spec-to-phpunit/src/Rector/MethodCall/PhpSpecPromisesToPHPUnitAssertRector.php +++ b/rules/php-spec-to-phpunit/src/Rector/MethodCall/PhpSpecPromisesToPHPUnitAssertRector.php @@ -116,12 +116,6 @@ final class PhpSpecPromisesToPHPUnitAssertRector extends AbstractPhpSpecToPHPUni $this->matchersManipulator = $matchersManipulator; } - protected function tearDown(): void - { - $this->isPrepared = false; - $this->matchersKeys = []; - } - /** * @return string[] */ @@ -135,6 +129,9 @@ final class PhpSpecPromisesToPHPUnitAssertRector extends AbstractPhpSpecToPHPUni */ public function refactor(Node $node): ?Node { + $this->isPrepared = false; + $this->matchersKeys = []; + if (! $this->isInPhpSpecBehavior($node)) { return null; } diff --git a/src/Rector/AbstractRector.php b/src/Rector/AbstractRector.php index af0b1a61969..8db0409a1ee 100644 --- a/src/Rector/AbstractRector.php +++ b/src/Rector/AbstractRector.php @@ -108,13 +108,6 @@ abstract class AbstractRector extends NodeVisitorAbstract implements PhpRectorIn AttributeKey::RESOLVED_NAME, ]; - /** - * Run once in the every end of one processed file - */ - protected function tearDown(): void - { - } - /** * @required */ @@ -220,8 +213,6 @@ abstract class AbstractRector extends NodeVisitorAbstract implements PhpRectorIn $nodes = $commander->traverseNodes($nodes); } - $this->tearDown(); - return $nodes; }