mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
remove left-over of Generic rules
This commit is contained in:
parent
1e7ad43b4d
commit
de5026fdb1
@ -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;'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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');
|
||||
}
|
||||
|
@ -60,9 +60,4 @@ final class RecipeOption
|
||||
* @var string
|
||||
*/
|
||||
public const EXTRA_FILE_NAME = 'extra_file_name';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_CORE = 'Rector';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user