Skip to content

Commit

Permalink
[PhpSpecToPHPUnit] Clean up unnecessary check already renamed to test (
Browse files Browse the repository at this point in the history
…#1779)

* [PhpSpecToPHPUnit] Clean up unnecessary check already renamed to test

* [PhpSpecToPHPUnit] Clean up unnecessary check already renamed to test
  • Loading branch information
samsonasik committed Feb 8, 2022
1 parent 31cffa8 commit ea69b90
Showing 1 changed file with 0 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@
*/
final class PhpSpecClassToPHPUnitClassRector extends AbstractPhpSpecToPHPUnitRector
{
/**
* @var string
*/
private const ALREADY_RENAMED_TO_TEST = 'already_renamed_to_test';

public function __construct(
private readonly ClassInsertManipulator $classInsertManipulator,
private readonly LetManipulator $letManipulator,
Expand All @@ -60,17 +55,11 @@ public function refactor(Node $node): ?Node
return null;
}

$isAlreadyRenamedToTest = (bool) $node->getAttribute(self::ALREADY_RENAMED_TO_TEST, false);
if ($isAlreadyRenamedToTest) {
return null;
}

// 1. change namespace name to PHPUnit-like
$this->phpSpecRenaming->renameNamespace($node);

$propertyName = $this->phpSpecRenaming->resolveObjectPropertyName($node);

$node->setAttribute(self::ALREADY_RENAMED_TO_TEST, true);
$this->phpSpecRenaming->renameClass($node);
$this->phpSpecRenaming->renameExtends($node);

Expand Down

0 comments on commit ea69b90

Please sign in to comment.