Skip to content

Commit

Permalink
Fix Rector extension config loading (#4946)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Sep 9, 2023
1 parent 41870cb commit b8485c6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 36 deletions.
4 changes: 2 additions & 2 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
$rectorConfig->cacheClass(MemoryCacheStorage::class);
}

// load internal rector-* extension configs
$extensionConfigResolver = new ExtensionConfigResolver();
$extensionConfigFiles = $extensionConfigResolver->provide();
foreach ($extensionConfigFiles as $extensionConfigFile) {
foreach ($extensionConfigResolver->provide() as $extensionConfigFile) {
$rectorConfig->import($extensionConfigFile);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@

final class FunctionLikeParamArgPositionNodeVisitor extends NodeVisitorAbstract
{
/**
* @return Node
*/
public function enterNode(Node $node): ?Node
{
if ($node instanceof FunctionLike) {
Expand Down
32 changes: 1 addition & 31 deletions src/DependencyInjection/LazyContainerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@
use Rector\PHPStanStaticTypeMapper\TypeMapper\TypeWithClassNameTypeMapper;
use Rector\PHPStanStaticTypeMapper\TypeMapper\VoidTypeMapper;
use Rector\PostRector\Application\PostFileProcessor;
use Rector\RectorGenerator\Command\GenerateCommand;
use Rector\RectorGenerator\Command\InitRecipeCommand;
use Rector\Skipper\Skipper\Skipper;
use Rector\StaticTypeMapper\Contract\PhpDocParser\PhpDocTypeMapperInterface;
use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
Expand Down Expand Up @@ -370,30 +368,7 @@ public function create(): RectorConfig
{
$rectorConfig = new RectorConfig();

// setup base parameters - from RectorConfig
// make use of https://github.com/symplify/easy-parallel
// $rectorConfig->import(EasyParallelConfig::FILE_PATH);

$rectorConfig->paths([]);
$rectorConfig->skip([]);

$rectorConfig->autoloadPaths([]);
$rectorConfig->bootstrapFiles([]);
$rectorConfig->parallel(120, 16, 20);

// to avoid autoimporting out of the box
$rectorConfig->importNames(false, false);
$rectorConfig->removeUnusedImports(false);

$rectorConfig->importShortClasses();
$rectorConfig->indent(' ', 4);

$rectorConfig->fileExtensions(['php']);

$rectorConfig->cacheDirectory(sys_get_temp_dir() . '/rector_cached_files');
$rectorConfig->containerCacheDirectory(sys_get_temp_dir());

// make use of https://github.com/symplify/easy-parallel
$rectorConfig->import(__DIR__ . '/../../config/config.php');

$rectorConfig->singleton(Application::class, static function (Container $container): Application {
$application = $container->make(ConsoleApplication::class);
Expand Down Expand Up @@ -436,11 +411,6 @@ public function create(): RectorConfig
$rectorConfig->singleton(PhpFileProcessor::class);
$rectorConfig->singleton(PostFileProcessor::class);

if (class_exists(InitRecipeCommand::class)) {
$rectorConfig->tag(InitRecipeCommand::class, Command::class);
$rectorConfig->tag(GenerateCommand::class, Command::class);
}

// phpdoc-parser
$rectorConfig->when(TypeParser::class)
->needs('$usedAttributes')
Expand Down

0 comments on commit b8485c6

Please sign in to comment.