Move Bootstrap file includer to load in RectorContainerFactory (#2382)

* Move Bootstrap file includer to load in RectorContainerFactory

* [ci-review] Rector Rectify

* keep in test

* back to ^1.7.1

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Abdul Malik Ikhsan 2022-05-28 02:41:24 +07:00 committed by GitHub
parent 429e5746ea
commit 38cb4c9684
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -7,7 +7,7 @@
], ],
"require": { "require": {
"php": "^7.2|^8.0", "php": "^7.2|^8.0",
"phpstan/phpstan": "1.7.1" "phpstan/phpstan": "^1.7.1"
}, },
"autoload": { "autoload": {
"files": [ "files": [

View File

@ -19,7 +19,7 @@
"nikic/php-parser": "^4.13.2", "nikic/php-parser": "^4.13.2",
"ondram/ci-detector": "^4.1", "ondram/ci-detector": "^4.1",
"phpstan/phpdoc-parser": "^1.5.1", "phpstan/phpdoc-parser": "^1.5.1",
"phpstan/phpstan": "1.7.1", "phpstan/phpstan": "^1.7.1",
"phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-phpunit": "^1.0",
"react/child-process": "^0.6.4", "react/child-process": "^0.6.4",
"react/event-loop": "^1.3", "react/event-loop": "^1.3",

View File

@ -8,7 +8,6 @@ use Rector\Caching\Detector\ChangedFilesDetector;
use Rector\ChangesReporting\Output\JsonOutputFormatter; use Rector\ChangesReporting\Output\JsonOutputFormatter;
use Rector\Core\Application\ApplicationFileProcessor; use Rector\Core\Application\ApplicationFileProcessor;
use Rector\Core\Autoloading\AdditionalAutoloader; use Rector\Core\Autoloading\AdditionalAutoloader;
use Rector\Core\Autoloading\BootstrapFilesIncluder;
use Rector\Core\Configuration\Option; use Rector\Core\Configuration\Option;
use Rector\Core\Console\Output\OutputFormatterCollector; use Rector\Core\Console\Output\OutputFormatterCollector;
use Rector\Core\Contract\Console\OutputStyleInterface; use Rector\Core\Contract\Console\OutputStyleInterface;
@ -33,7 +32,6 @@ final class ProcessCommand extends AbstractProcessCommand
private readonly ChangedFilesDetector $changedFilesDetector, private readonly ChangedFilesDetector $changedFilesDetector,
private readonly MissingRectorRulesReporter $missingRectorRulesReporter, private readonly MissingRectorRulesReporter $missingRectorRulesReporter,
private readonly ApplicationFileProcessor $applicationFileProcessor, private readonly ApplicationFileProcessor $applicationFileProcessor,
private readonly BootstrapFilesIncluder $bootstrapFilesIncluder,
private readonly ProcessResultFactory $processResultFactory, private readonly ProcessResultFactory $processResultFactory,
private readonly DynamicSourceLocatorDecorator $dynamicSourceLocatorDecorator, private readonly DynamicSourceLocatorDecorator $dynamicSourceLocatorDecorator,
private readonly EmptyConfigurableRectorChecker $emptyConfigurableRectorChecker, private readonly EmptyConfigurableRectorChecker $emptyConfigurableRectorChecker,
@ -67,9 +65,6 @@ final class ProcessCommand extends AbstractProcessCommand
$this->rectorOutputStyle->setVerbosity(OutputInterface::VERBOSITY_QUIET); $this->rectorOutputStyle->setVerbosity(OutputInterface::VERBOSITY_QUIET);
} }
// register autoloaded and included files
$this->bootstrapFilesIncluder->includeBootstrapFiles();
$this->additionalAutoloader->autoloadInput($input); $this->additionalAutoloader->autoloadInput($input);
$this->additionalAutoloader->autoloadPaths(); $this->additionalAutoloader->autoloadPaths();

View File

@ -7,6 +7,7 @@ namespace Rector\Core\DependencyInjection;
use Nette\Utils\FileSystem; use Nette\Utils\FileSystem;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use Rector\Caching\Detector\ChangedFilesDetector; use Rector\Caching\Detector\ChangedFilesDetector;
use Rector\Core\Autoloading\BootstrapFilesIncluder;
use Rector\Core\Kernel\RectorKernel; use Rector\Core\Kernel\RectorKernel;
use Rector\Core\ValueObject\Bootstrap\BootstrapConfigs; use Rector\Core\ValueObject\Bootstrap\BootstrapConfigs;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
@ -42,6 +43,10 @@ final class RectorContainerFactory
$changedFilesDetector->setFirstResolvedConfigFileInfo($mainConfigFile); $changedFilesDetector->setFirstResolvedConfigFileInfo($mainConfigFile);
} }
/** @var BootstrapFilesIncluder $bootstrapFilesIncluder */
$bootstrapFilesIncluder = $container->get(BootstrapFilesIncluder::class);
$bootstrapFilesIncluder->includeBootstrapFiles();
return $container; return $container;
} }