diff --git a/packages/rector-generator/src/Command/CreateCommand.php b/packages/rector-generator/src/Command/CreateCommand.php index 8cdc8f1e3cd..8c6a4cc39b8 100644 --- a/packages/rector-generator/src/Command/CreateCommand.php +++ b/packages/rector-generator/src/Command/CreateCommand.php @@ -15,7 +15,6 @@ use Rector\RectorGenerator\Guard\OverrideGuard; use Rector\RectorGenerator\TemplateFactory; use Rector\RectorGenerator\TemplateVariablesFactory; use Rector\RectorGenerator\ValueObject\Configuration; -use Rector\RectorGenerator\ValueObject\RecipeOption; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -177,9 +176,6 @@ final class CreateCommand extends Command ); $content = $this->templateFactory->create($smartFileInfo->getContents(), $templateVariables); - if ($configuration->getPackage() === RecipeOption::PACKAGE_CORE) { - $content = $this->addOneMoreRectorNesting($content); - } $this->smartFileSystem->dumpFile($destination, $content); @@ -206,15 +202,4 @@ final class CreateCommand extends Command $this->symfonyStyle->success($message); } - - private function addOneMoreRectorNesting(string $content): string - { - $content = Strings::replace($content, '#Rector\\\\Rector\\\\#ms', 'Rector\\Core\\'); - - return Strings::replace( - $content, - '#use Rector\\\\AbstractRector;#', - 'use Rector\\Core\\Rector\\AbstractRector;' - ); - } } diff --git a/packages/rector-generator/src/FileSystem/TemplateFileSystem.php b/packages/rector-generator/src/FileSystem/TemplateFileSystem.php index 4d51520750a..8e47d9c1a43 100644 --- a/packages/rector-generator/src/FileSystem/TemplateFileSystem.php +++ b/packages/rector-generator/src/FileSystem/TemplateFileSystem.php @@ -8,7 +8,6 @@ use Nette\Utils\Strings; use Rector\RectorGenerator\Finder\TemplateFinder; use Rector\RectorGenerator\ValueObject\Configuration; use Rector\RectorGenerator\ValueObject\Package; -use Rector\RectorGenerator\ValueObject\RecipeOption; use Symplify\SmartFileSystem\SmartFileInfo; final class TemplateFileSystem @@ -24,10 +23,7 @@ final class TemplateFileSystem $destination = $smartFileInfo->getRelativeFilePathFromDirectory(TemplateFinder::TEMPLATES_DIRECTORY); // normalize core package - if ($configuration->getPackage() === RecipeOption::PACKAGE_CORE) { - $destination = Strings::replace($destination, '#rules\/__package__/tests/Rector#', 'tests/Rector'); - $destination = Strings::replace($destination, '#rules\/__package__/src/Rector#', 'src/Rector'); - } elseif ($configuration->getPackage() === Package::UTILS) { + if ($configuration->getPackage() === Package::UTILS) { // special keyword for 3rd party Rectors, not for core Github contribution $destination = Strings::replace($destination, '#packages\/__Package__#', 'utils/rector'); } diff --git a/packages/rector-generator/src/ValueObject/RecipeOption.php b/packages/rector-generator/src/ValueObject/RecipeOption.php index 4bfeb9af645..f4490555747 100644 --- a/packages/rector-generator/src/ValueObject/RecipeOption.php +++ b/packages/rector-generator/src/ValueObject/RecipeOption.php @@ -60,9 +60,4 @@ final class RecipeOption * @var string */ public const EXTRA_FILE_NAME = 'extra_file_name'; - - /** - * @var string - */ - public const PACKAGE_CORE = 'Rector'; }