diff --git a/composer.json b/composer.json index a28bbab5f366..1218051de750 100644 --- a/composer.json +++ b/composer.json @@ -37,15 +37,16 @@ "nette/robot-loader": "^3.4", "nette/utils": "^3.2", "nikic/php-parser": "^4.10.4", - "phpstan/phpstan": "^0.12.83", "phpstan/phpdoc-parser": "^0.5.4", + "phpstan/phpstan": "^0.12.83", "phpstan/phpstan-phpunit": "^0.12.18", - "rector/rector-symfony": "^0.10.3", - "rector/rector-nette": "^0.10.5", - "rector/rector-laravel": "^0.10.1", - "rector/rector-cakephp": "^0.10.3", - "rector/rector-phpunit": "^0.10.6", - "rector/rector-doctrine": "^0.10.2", + "rector/rector-cakephp": "dev-main", + "rector/rector-doctrine": "dev-main", + "rector/rector-installer": "dev-main", + "rector/rector-laravel": "dev-main", + "rector/rector-nette": "dev-main", + "rector/rector-phpunit": "dev-main", + "rector/rector-symfony": "dev-main", "sebastian/diff": "^4.0.4", "symfony/console": "^4.4.8|^5.1", "symfony/dependency-injection": "^5.1", @@ -73,7 +74,7 @@ "nette/forms": "^3.0", "phpstan/phpstan-nette": "^0.12.16", "phpunit/phpunit": "^9.5", - "rector/rector-generator": "^0.1.5", + "rector/rector-generator": "dev-main", "symplify/coding-standard": "^9.2.16", "symplify/easy-ci": "^9.2.16", "symplify/easy-coding-standard": "^9.2.16", @@ -153,5 +154,7 @@ "config": { "sort-packages": true, "platform-check": false - } + }, + "minimum-stability": "dev", + "prefer-stable": true } diff --git a/config/config.php b/config/config.php index 2a080b9393a6..e60c55f3578c 100644 --- a/config/config.php +++ b/config/config.php @@ -2,8 +2,8 @@ declare(strict_types=1); +use Rector\Core\Bootstrap\ExtensionConfigResolver; use Rector\Core\Configuration\Option; -use Rector\RectorGenerator\Bundle\RectorGeneratorBundle; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { @@ -12,32 +12,10 @@ $containerConfigurator->import(__DIR__ . '/services-packages.php'); $containerConfigurator->import(__DIR__ . '/parameters.php'); - // rector root - $containerConfigurator->import(__DIR__ . '/../vendor/rector/rector-symfony/config/config.php', null, 'not_found'); - $containerConfigurator->import(__DIR__ . '/../vendor/rector/rector-nette/config/config.php', null, 'not_found'); - $containerConfigurator->import(__DIR__ . '/../vendor/rector/rector-laravel/config/config.php', null, 'not_found'); - $containerConfigurator->import(__DIR__ . '/../vendor/rector/rector-phpunit/config/config.php', null, 'not_found'); - $containerConfigurator->import(__DIR__ . '/../vendor/rector/rector-cakephp/config/config.php', null, 'not_found'); - $containerConfigurator->import(__DIR__ . '/../vendor/rector/rector-doctrine/config/config.php', null, 'not_found'); - - // rector sub-package - $containerConfigurator->import(__DIR__ . '/../../rector-symfony/config/config.php', null, 'not_found'); - $containerConfigurator->import(__DIR__ . '/../../rector-nette/config/config.php', null, 'not_found'); - $containerConfigurator->import(__DIR__ . '/../../rector-laravel/config/config.php', null, 'not_found'); - $containerConfigurator->import(__DIR__ . '/../../rector-phpunit/config/config.php', null, 'not_found'); - $containerConfigurator->import(__DIR__ . '/../../rector-cakephp/config/config.php', null, 'not_found'); - $containerConfigurator->import(__DIR__ . '/../../rector-doctrine/config/config.php', null, 'not_found'); - - // only for dev - // only for dev - if (class_exists(RectorGeneratorBundle::class)) { - $containerConfigurator->import( - __DIR__ . '/../vendor/rector/rector-generator/config/config.php', - null, - 'not_found' - ); - // 3rd party dependency - $containerConfigurator->import(__DIR__ . '/../../rector-generator/config/config.php', null, 'not_found'); + $extensionConfigResolver = new ExtensionConfigResolver(); + $extensionConfigFiles = $extensionConfigResolver->provide(); + foreach ($extensionConfigFiles as $extensionConfigFile) { + $containerConfigurator->import($extensionConfigFile->getRealPath()); } // require only in dev diff --git a/src/Bootstrap/ExtensionConfigResolver.php b/src/Bootstrap/ExtensionConfigResolver.php index a62ae60cdb63..83f891354430 100644 --- a/src/Bootstrap/ExtensionConfigResolver.php +++ b/src/Bootstrap/ExtensionConfigResolver.php @@ -11,11 +11,12 @@ final class ExtensionConfigResolver { /** - * @param SmartFileInfo[] $configFileInfos * @return SmartFileInfo[] */ - public function appendExtensionsConfig(array $configFileInfos): array + public function provide(): array { + $configFileInfos = []; + if (! class_exists('Rector\RectorInstaller\GeneratedConfig')) { return $configFileInfos; } diff --git a/src/Bootstrap/RectorConfigsResolver.php b/src/Bootstrap/RectorConfigsResolver.php index 3b01a59a82d0..9982f327ca46 100644 --- a/src/Bootstrap/RectorConfigsResolver.php +++ b/src/Bootstrap/RectorConfigsResolver.php @@ -70,7 +70,6 @@ public function provide(): BootstrapConfigs ) : []; $configFileInfos = $this->appendRectorRecipeConfig($argvInput, $configFileInfos); - $configFileInfos = $this->extensionConfigResolver->appendExtensionsConfig($configFileInfos); return new BootstrapConfigs($mainConfigFileInfo, $configFileInfos); }