diff --git a/config/config.php b/config/config.php index 58df17a1bc0..1791fbd483e 100644 --- a/config/config.php +++ b/config/config.php @@ -13,7 +13,6 @@ return static function (RectorConfig $rectorConfig) : void { $rectorConfig->autoloadPaths([]); $rectorConfig->bootstrapFiles([]); $rectorConfig->parallel(); - $rectorConfig->disableCollectors(); // to avoid autoimporting out of the box $rectorConfig->importNames(\false, \false); $rectorConfig->removeUnusedImports(\false); diff --git a/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenCollectorRector.php b/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenCollectorRector.php deleted file mode 100644 index 5c4c4b0ea3e..00000000000 --- a/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenCollectorRector.php +++ /dev/null @@ -1,127 +0,0 @@ -classAnalyzer = $classAnalyzer; - $this->visibilityManipulator = $visibilityManipulator; - $this->reflectionResolver = $reflectionResolver; - $this->doctrineEntityAnalyzer = $doctrineEntityAnalyzer; - } - /** - * @return array> - */ - public function getNodeTypes() : array - { - return [Class_::class]; - } - /** - * @param Class_ $node - */ - public function refactor(Node $node) : ?Node - { - if ($this->shouldSkipClass($node)) { - return null; - } - if ($this->doctrineEntityAnalyzer->hasClassAnnotation($node)) { - return null; - } - $classReflection = $this->reflectionResolver->resolveClassReflection($node); - if (!$classReflection instanceof ClassReflection) { - return null; - } - if ($this->doctrineEntityAnalyzer->hasClassReflectionAttribute($classReflection)) { - return null; - } - $parentClassNames = $this->resolveCollectedParentClassNames($this->getCollectedDataNode()); - // the class is being extended in the code, so we should skip it here - if ($this->nodeNameResolver->isNames($node, $parentClassNames)) { - return null; - } - if ($node->attrGroups !== []) { - // improve reprint with correct newline - $node->setAttribute(AttributeKey::ORIGINAL_NODE, null); - } - $this->visibilityManipulator->makeFinal($node); - return $node; - } - public function getRuleDefinition() : RuleDefinition - { - return new RuleDefinition('Finalize classes without children using collectors', [new CodeSample(<<<'CODE_SAMPLE' -class FirstClass extends SecondClass -{ -} - -class SecondClass -{ -} -CODE_SAMPLE -, <<<'CODE_SAMPLE' -final class FirstClass extends SecondClass -{ -} - -class SecondClass -{ -} -CODE_SAMPLE -)]); - } - private function shouldSkipClass(Class_ $class) : bool - { - if ($class->isFinal() || $class->isAbstract()) { - return \true; - } - return $this->classAnalyzer->isAnonymousClass($class); - } - /** - * @return string[] - */ - private function resolveCollectedParentClassNames(CollectedDataNode $collectedDataNode) : array - { - $parentClassCollectorData = $collectedDataNode->get(ParentClassCollector::class); - $parentClassNames = Arrays::flatten($parentClassCollectorData); - return \array_unique($parentClassNames); - } -} diff --git a/src/Application/ApplicationFileProcessor.php b/src/Application/ApplicationFileProcessor.php index 6c073c9df9d..49c311f7dab 100644 --- a/src/Application/ApplicationFileProcessor.php +++ b/src/Application/ApplicationFileProcessor.php @@ -156,7 +156,6 @@ final class ApplicationFileProcessor if ($currentFileDiff instanceof FileDiff) { $fileDiffs[] = $currentFileDiff; } - $collectedData = \array_merge($collectedData, $fileProcessResult->getCollectedData()); // progress bar on parallel handled on runParallel() if (\is_callable($postFileCallback)) { $postFileCallback(1); diff --git a/src/Application/Collector/CollectorNodeVisitor.php b/src/Application/Collector/CollectorNodeVisitor.php deleted file mode 100644 index c3b2eada263..00000000000 --- a/src/Application/Collector/CollectorNodeVisitor.php +++ /dev/null @@ -1,66 +0,0 @@ -collectorRegistry = $collectorRegistry; - } - /** - * @param Node[] $nodes - */ - public function beforeTraverse(array $nodes) : ?array - { - $this->collectedDatas = []; - return null; - } - public function enterNode(Node $node) - { - $collectors = $this->collectorRegistry->getCollectors(\get_class($node)); - /** @var Scope $scope */ - $scope = $node->getAttribute(AttributeKey::SCOPE); - foreach ($collectors as $collector) { - try { - $collectedData = $collector->processNode($node, $scope); - } catch (Throwable $exception) { - // nothing to collect - continue; - } - // no data collected - if ($collectedData === null) { - continue; - } - $this->collectedDatas[] = new CollectedData($collectedData, $scope->getFile(), \get_class($collector)); - } - return null; - } - /** - * @return CollectedData[] - */ - public function getCollectedData() : array - { - return $this->collectedDatas; - } -} diff --git a/src/Application/Collector/CollectorProcessor.php b/src/Application/Collector/CollectorProcessor.php deleted file mode 100644 index 0a5387d8a8d..00000000000 --- a/src/Application/Collector/CollectorProcessor.php +++ /dev/null @@ -1,38 +0,0 @@ -collectorNodeVisitor = new \Rector\Application\Collector\CollectorNodeVisitor($collectorRegistry); - $nodeTraverser->addVisitor($this->collectorNodeVisitor); - $this->nodeTraverser = $nodeTraverser; - } - /** - * @param Node[] $stmts - * @return CollectedData[] - */ - public function process(array $stmts) : array - { - $this->nodeTraverser->traverse($stmts); - return $this->collectorNodeVisitor->getCollectedData(); - } -} diff --git a/src/Application/FileProcessor.php b/src/Application/FileProcessor.php index 94a705d6fc5..113d1692fc4 100644 --- a/src/Application/FileProcessor.php +++ b/src/Application/FileProcessor.php @@ -4,7 +4,6 @@ declare (strict_types=1); namespace Rector\Application; use PHPStan\AnalysedCodeException; -use Rector\Application\Collector\CollectorProcessor; use Rector\Caching\Detector\ChangedFilesDetector; use Rector\ChangesReporting\ValueObjectFactory\ErrorFactory; use Rector\ChangesReporting\ValueObjectFactory\FileDiffFactory; @@ -61,11 +60,6 @@ final class FileProcessor * @var \Rector\FileSystem\FilePathHelper */ private $filePathHelper; - /** - * @readonly - * @var \Rector\Application\Collector\CollectorProcessor - */ - private $collectorProcessor; /** * @readonly * @var \Rector\PostRector\Application\PostFileProcessor @@ -81,7 +75,7 @@ final class FileProcessor * @var \Rector\NodeTypeResolver\NodeScopeAndMetadataDecorator */ private $nodeScopeAndMetadataDecorator; - public function __construct(FormatPerservingPrinter $formatPerservingPrinter, RectorNodeTraverser $rectorNodeTraverser, SymfonyStyle $symfonyStyle, FileDiffFactory $fileDiffFactory, ChangedFilesDetector $changedFilesDetector, ErrorFactory $errorFactory, FilePathHelper $filePathHelper, CollectorProcessor $collectorProcessor, PostFileProcessor $postFileProcessor, RectorParser $rectorParser, NodeScopeAndMetadataDecorator $nodeScopeAndMetadataDecorator) + public function __construct(FormatPerservingPrinter $formatPerservingPrinter, RectorNodeTraverser $rectorNodeTraverser, SymfonyStyle $symfonyStyle, FileDiffFactory $fileDiffFactory, ChangedFilesDetector $changedFilesDetector, ErrorFactory $errorFactory, FilePathHelper $filePathHelper, PostFileProcessor $postFileProcessor, RectorParser $rectorParser, NodeScopeAndMetadataDecorator $nodeScopeAndMetadataDecorator) { $this->formatPerservingPrinter = $formatPerservingPrinter; $this->rectorNodeTraverser = $rectorNodeTraverser; @@ -90,22 +84,17 @@ final class FileProcessor $this->changedFilesDetector = $changedFilesDetector; $this->errorFactory = $errorFactory; $this->filePathHelper = $filePathHelper; - $this->collectorProcessor = $collectorProcessor; $this->postFileProcessor = $postFileProcessor; $this->rectorParser = $rectorParser; $this->nodeScopeAndMetadataDecorator = $nodeScopeAndMetadataDecorator; } public function processFile(File $file, Configuration $configuration) : FileProcessResult { - if ($configuration->isSecondRun() && $configuration->isCollectors()) { - // 2nd run - $this->rectorNodeTraverser->prepareCollectorRectorsRun($configuration); - } // 1. parse files to nodes $parsingSystemError = $this->parseFileAndDecorateNodes($file); if ($parsingSystemError instanceof SystemError) { // we cannot process this file as the parsing and type resolving itself went wrong - return new FileProcessResult([$parsingSystemError], null, []); + return new FileProcessResult([$parsingSystemError], null); } $fileHasChanged = \false; $filePath = $file->getFilePath(); @@ -114,8 +103,6 @@ final class FileProcessor do { $file->changeHasChanged(\false); $newStmts = $this->rectorNodeTraverser->traverse($file->getNewStmts()); - // collect data - $fileCollectedData = $configuration->isCollectors() ? $this->collectorProcessor->process($newStmts) : []; // apply post rectors $postNewStmts = $this->postFileProcessor->traverse($newStmts, $filePath); // this is needed for new tokens added in "afterTraverse()" @@ -138,7 +125,7 @@ final class FileProcessor $currentFileDiff = $this->fileDiffFactory->createFileDiffWithLineChanges($file, $file->getOriginalFileContent(), $file->getFileContent(), $rectorWithLineChanges); $file->setFileDiff($currentFileDiff); } - return new FileProcessResult([], $file->getFileDiff(), $fileCollectedData); + return new FileProcessResult([], $file->getFileDiff()); } private function parseFileAndDecorateNodes(File $file) : ?SystemError { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 56dccb24346..1804021a62f 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '34ab8dc0f9a7e8b7cfa1a88cdf36ced9020964f8'; + public const PACKAGE_VERSION = '5a3a59c50c7810296274eb4408737c8f2f8921e7'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-01-16 03:17:08'; + public const RELEASE_DATE = '2024-01-15 23:08:35'; /** * @var int */ diff --git a/src/Collector/MockedClassCollector.php b/src/Collector/MockedClassCollector.php deleted file mode 100644 index 6f111f23c20..00000000000 --- a/src/Collector/MockedClassCollector.php +++ /dev/null @@ -1,45 +0,0 @@ - - */ -final class MockedClassCollector implements Collector -{ - public function getNodeType() : string - { - return MethodCall::class; - } - /** - * @param MethodCall $node - * @return string[]|null - */ - public function processNode(Node $node, Scope $scope) : ?array - { - if (!$node->name instanceof Identifier) { - return null; - } - $methodName = $node->name->toString(); - if (!\in_array($methodName, ['createMock', 'buildMock'], \true)) { - return null; - } - $firstArg = $node->getArgs()[0] ?? null; - if (!$firstArg instanceof Arg) { - return null; - } - $mockedClassType = $scope->getType($firstArg->value); - if (!$mockedClassType instanceof ConstantStringType) { - return null; - } - return [$mockedClassType->getValue()]; - } -} diff --git a/src/Collector/ParentClassCollector.php b/src/Collector/ParentClassCollector.php deleted file mode 100644 index fb44d60065b..00000000000 --- a/src/Collector/ParentClassCollector.php +++ /dev/null @@ -1,31 +0,0 @@ - - */ -final class ParentClassCollector implements Collector -{ - public function getNodeType() : string - { - return Class_::class; - } - /** - * @param Class_ $node - * @return string[]|null - */ - public function processNode(Node $node, Scope $scope) : ?array - { - if (!$node->extends instanceof Name) { - return null; - } - return [$node->extends->toString()]; - } -} diff --git a/src/Config/RectorConfig.php b/src/Config/RectorConfig.php index 68cd9875a6d..456c3362790 100644 --- a/src/Config/RectorConfig.php +++ b/src/Config/RectorConfig.php @@ -64,13 +64,6 @@ final class RectorConfig extends Container { SimpleParameterProvider::setParameter(Option::PARALLEL, \false); } - /** - * @experimental since Rector 0.18.x - */ - public function enableCollectors() : void - { - SimpleParameterProvider::setParameter(Option::COLLECTORS, \true); - } /** * Defaults in sync with https://phpstan.org/config-reference#parallel-processing * as we run PHPStan as well @@ -180,8 +173,7 @@ final class RectorConfig extends Container */ public function collector(string $collectorClass) : void { - $this->singleton($collectorClass); - $this->tag($collectorClass, Collector::class); + \trigger_error('collector have been deprecated as performance costly and not valuable'); } /** * @param class-string $commandClass @@ -312,13 +304,6 @@ final class RectorConfig extends Container ContainerMemento::forgetService($this, $skippedClass); } } - /** - * @experimental since Rector 0.18.x - */ - public function disableCollectors() : void - { - SimpleParameterProvider::setParameter(Option::COLLECTORS, \false); - } /** * @internal Use to add tag on service registrations */ diff --git a/src/Configuration/ConfigurationFactory.php b/src/Configuration/ConfigurationFactory.php index ceb824e726f..73850b7de12 100644 --- a/src/Configuration/ConfigurationFactory.php +++ b/src/Configuration/ConfigurationFactory.php @@ -29,8 +29,7 @@ final class ConfigurationFactory public function createForTests(array $paths) : Configuration { $fileExtensions = SimpleParameterProvider::provideArrayParameter(\Rector\Configuration\Option::FILE_EXTENSIONS); - $isCollectors = SimpleParameterProvider::provideBoolParameter(\Rector\Configuration\Option::COLLECTORS, \false); - return new Configuration(\false, \true, \false, ConsoleOutputFormatter::NAME, $fileExtensions, $paths, \true, null, null, \false, null, \false, $isCollectors); + return new Configuration(\false, \true, \false, ConsoleOutputFormatter::NAME, $fileExtensions, $paths, \true, null, null, \false, null, \false); } /** * Needs to run in the start of the life cycle, since the rest of workflow uses it. @@ -49,8 +48,7 @@ final class ConfigurationFactory $parallelIdentifier = (string) $input->getOption(\Rector\Configuration\Option::PARALLEL_IDENTIFIER); $isDebug = (bool) $input->getOption(\Rector\Configuration\Option::DEBUG); $memoryLimit = $this->resolveMemoryLimit($input); - $isCollectors = SimpleParameterProvider::provideBoolParameter(\Rector\Configuration\Option::COLLECTORS); - return new Configuration($isDryRun, $showProgressBar, $shouldClearCache, $outputFormat, $fileExtensions, $paths, $showDiffs, $parallelPort, $parallelIdentifier, $isParallel, $memoryLimit, $isDebug, $isCollectors); + return new Configuration($isDryRun, $showProgressBar, $shouldClearCache, $outputFormat, $fileExtensions, $paths, $showDiffs, $parallelPort, $parallelIdentifier, $isParallel, $memoryLimit, $isDebug); } private function shouldShowProgressBar(InputInterface $input, string $outputFormat) : bool { diff --git a/src/Configuration/Option.php b/src/Configuration/Option.php index 364d743e760..dc537fb3ba6 100644 --- a/src/Configuration/Option.php +++ b/src/Configuration/Option.php @@ -195,9 +195,4 @@ final class Option * @var string */ public const REGISTERED_RECTOR_SETS = 'registered_rector_sets'; - /** - * @internal - * @var string - */ - public const COLLECTORS = 'collectors'; } diff --git a/src/Console/Command/ProcessCommand.php b/src/Console/Command/ProcessCommand.php index 196c0f094dc..75be36c10bd 100644 --- a/src/Console/Command/ProcessCommand.php +++ b/src/Console/Command/ProcessCommand.php @@ -115,21 +115,8 @@ final class ProcessCommand extends Command // MAIN PHASE // 2. run Rector $processResult = $this->applicationFileProcessor->run($configuration, $input); - // 3. collectors phase - if ($processResult->getCollectedData() !== []) { - $this->symfonyStyle->newLine(2); - $this->symfonyStyle->title('Running 2nd time with collectors data'); - $configuration->setCollectedData($processResult->getCollectedData()); - $configuration->enableSecondRun(); - // reset rules in Rector traverser - $nextProcessResult = $this->applicationFileProcessor->run($configuration, $input); - // @todo merge results here - $this->symfonyStyle->newLine(3); - // unset all rectors that are not collector - // set new collector rectors - have a custom tag? yes - } // REPORTING PHASE - // 4. reporting phaseRunning 2nd time with collectors data + // 3. reporting phaseRunning 2nd time with collectors data // report diffs and errors $outputFormat = $configuration->getOutputFormat(); $outputFormatter = $this->outputFormatterCollector->getByName($outputFormat); diff --git a/src/DependencyInjection/LazyContainerFactory.php b/src/DependencyInjection/LazyContainerFactory.php index 7944e369f6b..f8d9393a2d6 100644 --- a/src/DependencyInjection/LazyContainerFactory.php +++ b/src/DependencyInjection/LazyContainerFactory.php @@ -9,8 +9,6 @@ use RectorPrefix202401\Illuminate\Container\Container; use PhpParser\Lexer; use PHPStan\Analyser\NodeScopeResolver; use PHPStan\Analyser\ScopeFactory; -use PHPStan\Collectors\Collector; -use PHPStan\Collectors\Registry; use PHPStan\File\FileHelper; use PHPStan\Parser\Parser; use PHPStan\PhpDoc\TypeNodeResolver; @@ -47,7 +45,6 @@ use Rector\CodingStyle\ClassNameImport\ClassNameImportSkipVoter\ClassLikeNameCla use Rector\CodingStyle\ClassNameImport\ClassNameImportSkipVoter\FullyQualifiedNameClassNameImportSkipVoter; use Rector\CodingStyle\ClassNameImport\ClassNameImportSkipVoter\UsesClassNameImportSkipVoter; use Rector\CodingStyle\Contract\ClassNameImport\ClassNameImportSkipVoterInterface; -use Rector\Collector\ParentClassCollector; use Rector\Config\RectorConfig; use Rector\Configuration\ConfigInitializer; use Rector\Configuration\RenamedClassesDataCollector; @@ -243,10 +240,6 @@ final class LazyContainerFactory { $rectorConfig = new RectorConfig(); $rectorConfig->import(__DIR__ . '/../../config/config.php'); - // rector collectors - $rectorConfig->when(Registry::class)->needs('$collectors')->giveTagged(Collector::class); - // @todo collectors - just for testing purpose - $rectorConfig->collector(ParentClassCollector::class); $rectorConfig->singleton(Application::class, static function (Container $container) : Application { $application = $container->make(ConsoleApplication::class); $commandNamesToHide = ['list', 'completion', 'help', 'worker']; diff --git a/src/PhpParser/NodeTraverser/RectorNodeTraverser.php b/src/PhpParser/NodeTraverser/RectorNodeTraverser.php index 6e4b99528b8..d8058900b2d 100644 --- a/src/PhpParser/NodeTraverser/RectorNodeTraverser.php +++ b/src/PhpParser/NodeTraverser/RectorNodeTraverser.php @@ -5,10 +5,8 @@ namespace Rector\PhpParser\NodeTraverser; use PhpParser\Node; use PhpParser\NodeTraverser; -use PHPStan\Node\CollectedDataNode; use Rector\Contract\Rector\CollectorRectorInterface; use Rector\Contract\Rector\RectorInterface; -use Rector\ValueObject\Configuration; use Rector\VersionBonding\PhpVersionedFilter; final class RectorNodeTraverser extends NodeTraverser { @@ -16,10 +14,6 @@ final class RectorNodeTraverser extends NodeTraverser * @var RectorInterface[] */ private $rectors; - /** - * @var CollectorRectorInterface[] - */ - private $collectorRectors; /** * @readonly * @var \Rector\VersionBonding\PhpVersionedFilter @@ -31,12 +25,10 @@ final class RectorNodeTraverser extends NodeTraverser private $areNodeVisitorsPrepared = \false; /** * @param RectorInterface[] $rectors - * @param CollectorRectorInterface[] $collectorRectors */ - public function __construct(array $rectors, array $collectorRectors, PhpVersionedFilter $phpVersionedFilter) + public function __construct(array $rectors, PhpVersionedFilter $phpVersionedFilter) { $this->rectors = $rectors; - $this->collectorRectors = $collectorRectors; $this->phpVersionedFilter = $phpVersionedFilter; parent::__construct(); } @@ -59,19 +51,6 @@ final class RectorNodeTraverser extends NodeTraverser $this->visitors = []; $this->areNodeVisitorsPrepared = \false; } - public function prepareCollectorRectorsRun(Configuration $configuration) : void - { - if ($this->collectorRectors === []) { - return; - } - $collectedDataNode = new CollectedDataNode($configuration->getCollectedData(), \false); - // hydrate abstract collector rector with configuration - foreach ($this->collectorRectors as $collectorRector) { - $collectorRector->setCollectedDataNode($collectedDataNode); - } - $this->visitors = $this->collectorRectors; - $this->areNodeVisitorsPrepared = \true; - } /** * This must happen after $this->configuration is set after ProcessCommand::execute() is run, * otherwise we get default false positives. diff --git a/src/Rector/AbstractCollectorRector.php b/src/Rector/AbstractCollectorRector.php deleted file mode 100644 index 0ffdbbb6617..00000000000 --- a/src/Rector/AbstractCollectorRector.php +++ /dev/null @@ -1,32 +0,0 @@ -collectedDataNode = $collectedDataNode; - } - public function getCollectedDataNode() : CollectedDataNode - { - if (!$this->collectedDataNode instanceof CollectedDataNode) { - throw new ShouldNotHappenException('CollectedDataNode is not set'); - } - // this should be called only from CollectorRectorInterface - return $this->collectedDataNode; - } -} diff --git a/src/Testing/PHPUnit/AbstractRectorTestCase.php b/src/Testing/PHPUnit/AbstractRectorTestCase.php index 667c7ecec92..fb1ad93aa15 100644 --- a/src/Testing/PHPUnit/AbstractRectorTestCase.php +++ b/src/Testing/PHPUnit/AbstractRectorTestCase.php @@ -61,7 +61,6 @@ abstract class AbstractRectorTestCase extends \Rector\Testing\PHPUnit\AbstractLa SimpleParameterProvider::setParameter(Option::IMPORT_SHORT_CLASSES, \true); SimpleParameterProvider::setParameter(Option::INDENT_CHAR, ' '); SimpleParameterProvider::setParameter(Option::INDENT_SIZE, 4); - SimpleParameterProvider::setParameter(Option::COLLECTORS, \false); SimpleParameterProvider::setParameter(Option::POLYFILL_PACKAGES, []); } protected function setUp() : void @@ -212,14 +211,6 @@ abstract class AbstractRectorTestCase extends \Rector\Testing\PHPUnit\AbstractLa $configurationFactory = $this->make(ConfigurationFactory::class); $configuration = $configurationFactory->createForTests([$filePath]); $processResult = $this->applicationFileProcessor->processFiles([$filePath], $configuration); - if ($processResult->getCollectedData() !== [] && $configuration->isCollectors()) { - // second run with collected data - $configuration->setCollectedData($processResult->getCollectedData()); - $configuration->enableSecondRun(); - $rectorNodeTraverser = $this->make(RectorNodeTraverser::class); - $rectorNodeTraverser->prepareCollectorRectorsRun($configuration); - $this->applicationFileProcessor->processFiles([$filePath], $configuration); - } // return changed file contents $changedFileContents = FileSystem::read($filePath); return new RectorTestResult($changedFileContents, $processResult); diff --git a/src/ValueObject/Configuration.php b/src/ValueObject/Configuration.php index f321a106fb4..a558d509593 100644 --- a/src/ValueObject/Configuration.php +++ b/src/ValueObject/Configuration.php @@ -68,11 +68,6 @@ final class Configuration * @var bool */ private $isDebug = \false; - /** - * @readonly - * @var bool - */ - private $isCollectors = \false; /** * @var bool */ @@ -85,7 +80,7 @@ final class Configuration * @param string[] $fileExtensions * @param string[] $paths */ - public function __construct(bool $isDryRun = \false, bool $showProgressBar = \true, bool $shouldClearCache = \false, string $outputFormat = ConsoleOutputFormatter::NAME, array $fileExtensions = ['php'], array $paths = [], bool $showDiffs = \true, ?string $parallelPort = null, ?string $parallelIdentifier = null, bool $isParallel = \false, ?string $memoryLimit = null, bool $isDebug = \false, bool $isCollectors = \false) + public function __construct(bool $isDryRun = \false, bool $showProgressBar = \true, bool $shouldClearCache = \false, string $outputFormat = ConsoleOutputFormatter::NAME, array $fileExtensions = ['php'], array $paths = [], bool $showDiffs = \true, ?string $parallelPort = null, ?string $parallelIdentifier = null, bool $isParallel = \false, ?string $memoryLimit = null, bool $isDebug = \false) { $this->isDryRun = $isDryRun; $this->showProgressBar = $showProgressBar; @@ -99,7 +94,6 @@ final class Configuration $this->isParallel = $isParallel; $this->memoryLimit = $memoryLimit; $this->isDebug = $isDebug; - $this->isCollectors = $isCollectors; } public function isDryRun() : bool { @@ -191,11 +185,4 @@ final class Configuration { $this->isSecondRun = \false; } - /** - * @api - */ - public function isCollectors() : bool - { - return $this->isCollectors; - } } diff --git a/src/ValueObject/FileProcessResult.php b/src/ValueObject/FileProcessResult.php index 479629b1d6c..2cedf0218b3 100644 --- a/src/ValueObject/FileProcessResult.php +++ b/src/ValueObject/FileProcessResult.php @@ -3,7 +3,6 @@ declare (strict_types=1); namespace Rector\ValueObject; -use PHPStan\Collectors\CollectedData; use Rector\ValueObject\Error\SystemError; use Rector\ValueObject\Reporting\FileDiff; use RectorPrefix202401\Webmozart\Assert\Assert; @@ -19,22 +18,14 @@ final class FileProcessResult * @var \Rector\ValueObject\Reporting\FileDiff|null */ private $fileDiff; - /** - * @var CollectedData[] - * @readonly - */ - private $collectedDatas; /** * @param SystemError[] $systemErrors - * @param CollectedData[] $collectedDatas */ - public function __construct(array $systemErrors, ?FileDiff $fileDiff, array $collectedDatas) + public function __construct(array $systemErrors, ?FileDiff $fileDiff) { $this->systemErrors = $systemErrors; $this->fileDiff = $fileDiff; - $this->collectedDatas = $collectedDatas; Assert::allIsInstanceOf($systemErrors, SystemError::class); - Assert::allIsInstanceOf($collectedDatas, CollectedData::class); } /** * @return SystemError[] @@ -47,11 +38,4 @@ final class FileProcessResult { return $this->fileDiff; } - /** - * @return CollectedData[] - */ - public function getCollectedData() : array - { - return $this->collectedDatas; - } } diff --git a/src/core_namespace_aliases.php b/src/core_namespace_aliases.php index 75e8c4230db..7658690342b 100644 --- a/src/core_namespace_aliases.php +++ b/src/core_namespace_aliases.php @@ -7,20 +7,16 @@ namespace RectorPrefix202401; \class_alias('Rector\\Application\\ApplicationFileProcessor', 'Rector\\Core\\Application\\ApplicationFileProcessor'); \class_alias('Rector\\Application\\ChangedNodeScopeRefresher', 'Rector\\Core\\Application\\ChangedNodeScopeRefresher'); \class_alias('Rector\\Application\\Collector\\CollectorNodeVisitor', 'Rector\\Core\\Application\\Collector\\CollectorNodeVisitor'); -\class_alias('Rector\\Application\\Collector\\CollectorProcessor', 'Rector\\Core\\Application\\Collector\\CollectorProcessor'); \class_alias('Rector\\Application\\FileProcessor', 'Rector\\Core\\Application\\FileProcessor'); \class_alias('Rector\\Application\\VersionResolver', 'Rector\\Core\\Application\\VersionResolver'); \class_alias('Rector\\Autoloading\\AdditionalAutoloader', 'Rector\\Core\\Autoloading\\AdditionalAutoloader'); \class_alias('Rector\\Autoloading\\BootstrapFilesIncluder', 'Rector\\Core\\Autoloading\\BootstrapFilesIncluder'); \class_alias('Rector\\Bootstrap\\ExtensionConfigResolver', 'Rector\\Core\\Bootstrap\\ExtensionConfigResolver'); \class_alias('Rector\\Bootstrap\\RectorConfigsResolver', 'Rector\\Core\\Bootstrap\\RectorConfigsResolver'); -\class_alias('Rector\\Collector\\MockedClassCollector', 'Rector\\Core\\Collector\\MockedClassCollector'); -\class_alias('Rector\\Collector\\ParentClassCollector', 'Rector\\Core\\Collector\\ParentClassCollector'); \class_alias('Rector\\Configuration\\ConfigInitializer', 'Rector\\Core\\Configuration\\ConfigInitializer'); \class_alias('Rector\\Configuration\\ConfigurationFactory', 'Rector\\Core\\Configuration\\ConfigurationFactory'); \class_alias('Rector\\Configuration\\Option', 'Rector\\Core\\Configuration\\Option'); \class_alias('Rector\\Configuration\\Parameter\\SimpleParameterProvider', 'Rector\\Core\\Configuration\\Parameter\\SimpleParameterProvider'); -\class_alias('Rector\\Configuration\\RenamedClassesDataCollector', 'Rector\\Core\\Configuration\\RenamedClassesDataCollector'); \class_alias('Rector\\Console\\Command\\ListRulesCommand', 'Rector\\Core\\Console\\Command\\ListRulesCommand'); \class_alias('Rector\\Console\\Command\\ProcessCommand', 'Rector\\Core\\Console\\Command\\ProcessCommand'); \class_alias('Rector\\Console\\Command\\SetupCICommand', 'Rector\\Core\\Console\\Command\\SetupCICommand'); @@ -118,7 +114,6 @@ namespace RectorPrefix202401; \class_alias('Rector\\PhpParser\\ValueObject\\StmtsAndTokens', 'Rector\\Core\\PhpParser\\ValueObject\\StmtsAndTokens'); \class_alias('Rector\\ProcessAnalyzer\\RectifiedAnalyzer', 'Rector\\Core\\ProcessAnalyzer\\RectifiedAnalyzer'); \class_alias('Rector\\Provider\\CurrentFileProvider', 'Rector\\Core\\Provider\\CurrentFileProvider'); -\class_alias('Rector\\Rector\\AbstractCollectorRector', 'Rector\\Core\\Rector\\AbstractCollectorRector'); \class_alias('Rector\\Rector\\AbstractRector', 'Rector\\Core\\Rector\\AbstractRector'); \class_alias('Rector\\Rector\\AbstractScopeAwareRector', 'Rector\\Core\\Rector\\AbstractScopeAwareRector'); \class_alias('Rector\\Reflection\\ClassModifierChecker', 'Rector\\Core\\Reflection\\ClassModifierChecker'); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 8033659aeaf..2121eea0a38 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -945,8 +945,6 @@ return array( 'RectorPrefix202401\\Webmozart\\Assert\\Mixin' => $vendorDir . '/webmozart/assert/src/Mixin.php', 'Rector\\Application\\ApplicationFileProcessor' => $baseDir . '/src/Application/ApplicationFileProcessor.php', 'Rector\\Application\\ChangedNodeScopeRefresher' => $baseDir . '/src/Application/ChangedNodeScopeRefresher.php', - 'Rector\\Application\\Collector\\CollectorNodeVisitor' => $baseDir . '/src/Application/Collector/CollectorNodeVisitor.php', - 'Rector\\Application\\Collector\\CollectorProcessor' => $baseDir . '/src/Application/Collector/CollectorProcessor.php', 'Rector\\Application\\FileProcessor' => $baseDir . '/src/Application/FileProcessor.php', 'Rector\\Application\\VersionResolver' => $baseDir . '/src/Application/VersionResolver.php', 'Rector\\Arguments\\ArgumentDefaultValueReplacer' => $baseDir . '/rules/Arguments/ArgumentDefaultValueReplacer.php', @@ -1168,8 +1166,6 @@ return array( 'Rector\\CodingStyle\\Rector\\Use_\\SeparateMultiUseImportsRector' => $baseDir . '/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php', 'Rector\\CodingStyle\\Reflection\\VendorLocationDetector' => $baseDir . '/rules/CodingStyle/Reflection/VendorLocationDetector.php', 'Rector\\CodingStyle\\ValueObject\\ObjectMagicMethods' => $baseDir . '/rules/CodingStyle/ValueObject/ObjectMagicMethods.php', - 'Rector\\Collector\\MockedClassCollector' => $baseDir . '/src/Collector/MockedClassCollector.php', - 'Rector\\Collector\\ParentClassCollector' => $baseDir . '/src/Collector/ParentClassCollector.php', 'Rector\\Comments\\CommentRemover' => $baseDir . '/src/Comments/CommentRemover.php', 'Rector\\Comments\\NodeDocBlock\\DocBlockUpdater' => $baseDir . '/src/Comments/NodeDocBlock/DocBlockUpdater.php', 'Rector\\Comments\\NodeTraverser\\CommentRemovingNodeTraverser' => $baseDir . '/src/Comments/NodeTraverser/CommentRemovingNodeTraverser.php', @@ -1959,7 +1955,6 @@ return array( 'Rector\\Privatization\\Guard\\ParentPropertyLookupGuard' => $baseDir . '/rules/Privatization/Guard/ParentPropertyLookupGuard.php', 'Rector\\Privatization\\NodeManipulator\\VisibilityManipulator' => $baseDir . '/rules/Privatization/NodeManipulator/VisibilityManipulator.php', 'Rector\\Privatization\\Rector\\ClassMethod\\PrivatizeFinalClassMethodRector' => $baseDir . '/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php', - 'Rector\\Privatization\\Rector\\Class_\\FinalizeClassesWithoutChildrenCollectorRector' => $baseDir . '/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenCollectorRector.php', 'Rector\\Privatization\\Rector\\Class_\\FinalizeClassesWithoutChildrenRector' => $baseDir . '/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector.php', 'Rector\\Privatization\\Rector\\MethodCall\\PrivatizeLocalGetterToPropertyRector' => $baseDir . '/rules/Privatization/Rector/MethodCall/PrivatizeLocalGetterToPropertyRector.php', 'Rector\\Privatization\\Rector\\Property\\PrivatizeFinalClassPropertyRector' => $baseDir . '/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php', @@ -1972,7 +1967,6 @@ return array( 'Rector\\RectorInstaller\\LocalFilesystem' => $vendorDir . '/rector/extension-installer/src/LocalFilesystem.php', 'Rector\\RectorInstaller\\Plugin' => $vendorDir . '/rector/extension-installer/src/Plugin.php', 'Rector\\RectorInstaller\\PluginInstaller' => $vendorDir . '/rector/extension-installer/src/PluginInstaller.php', - 'Rector\\Rector\\AbstractCollectorRector' => $baseDir . '/src/Rector/AbstractCollectorRector.php', 'Rector\\Rector\\AbstractRector' => $baseDir . '/src/Rector/AbstractRector.php', 'Rector\\Rector\\AbstractScopeAwareRector' => $baseDir . '/src/Rector/AbstractScopeAwareRector.php', 'Rector\\Reflection\\ClassModifierChecker' => $baseDir . '/src/Reflection/ClassModifierChecker.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index d9c9b377e8c..1e04d0c85f8 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -1159,8 +1159,6 @@ class ComposerStaticInit0d7ac37abdc3277d2804c7296dfa0f13 'RectorPrefix202401\\Webmozart\\Assert\\Mixin' => __DIR__ . '/..' . '/webmozart/assert/src/Mixin.php', 'Rector\\Application\\ApplicationFileProcessor' => __DIR__ . '/../..' . '/src/Application/ApplicationFileProcessor.php', 'Rector\\Application\\ChangedNodeScopeRefresher' => __DIR__ . '/../..' . '/src/Application/ChangedNodeScopeRefresher.php', - 'Rector\\Application\\Collector\\CollectorNodeVisitor' => __DIR__ . '/../..' . '/src/Application/Collector/CollectorNodeVisitor.php', - 'Rector\\Application\\Collector\\CollectorProcessor' => __DIR__ . '/../..' . '/src/Application/Collector/CollectorProcessor.php', 'Rector\\Application\\FileProcessor' => __DIR__ . '/../..' . '/src/Application/FileProcessor.php', 'Rector\\Application\\VersionResolver' => __DIR__ . '/../..' . '/src/Application/VersionResolver.php', 'Rector\\Arguments\\ArgumentDefaultValueReplacer' => __DIR__ . '/../..' . '/rules/Arguments/ArgumentDefaultValueReplacer.php', @@ -1382,8 +1380,6 @@ class ComposerStaticInit0d7ac37abdc3277d2804c7296dfa0f13 'Rector\\CodingStyle\\Rector\\Use_\\SeparateMultiUseImportsRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php', 'Rector\\CodingStyle\\Reflection\\VendorLocationDetector' => __DIR__ . '/../..' . '/rules/CodingStyle/Reflection/VendorLocationDetector.php', 'Rector\\CodingStyle\\ValueObject\\ObjectMagicMethods' => __DIR__ . '/../..' . '/rules/CodingStyle/ValueObject/ObjectMagicMethods.php', - 'Rector\\Collector\\MockedClassCollector' => __DIR__ . '/../..' . '/src/Collector/MockedClassCollector.php', - 'Rector\\Collector\\ParentClassCollector' => __DIR__ . '/../..' . '/src/Collector/ParentClassCollector.php', 'Rector\\Comments\\CommentRemover' => __DIR__ . '/../..' . '/src/Comments/CommentRemover.php', 'Rector\\Comments\\NodeDocBlock\\DocBlockUpdater' => __DIR__ . '/../..' . '/src/Comments/NodeDocBlock/DocBlockUpdater.php', 'Rector\\Comments\\NodeTraverser\\CommentRemovingNodeTraverser' => __DIR__ . '/../..' . '/src/Comments/NodeTraverser/CommentRemovingNodeTraverser.php', @@ -2173,7 +2169,6 @@ class ComposerStaticInit0d7ac37abdc3277d2804c7296dfa0f13 'Rector\\Privatization\\Guard\\ParentPropertyLookupGuard' => __DIR__ . '/../..' . '/rules/Privatization/Guard/ParentPropertyLookupGuard.php', 'Rector\\Privatization\\NodeManipulator\\VisibilityManipulator' => __DIR__ . '/../..' . '/rules/Privatization/NodeManipulator/VisibilityManipulator.php', 'Rector\\Privatization\\Rector\\ClassMethod\\PrivatizeFinalClassMethodRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php', - 'Rector\\Privatization\\Rector\\Class_\\FinalizeClassesWithoutChildrenCollectorRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenCollectorRector.php', 'Rector\\Privatization\\Rector\\Class_\\FinalizeClassesWithoutChildrenRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector.php', 'Rector\\Privatization\\Rector\\MethodCall\\PrivatizeLocalGetterToPropertyRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/MethodCall/PrivatizeLocalGetterToPropertyRector.php', 'Rector\\Privatization\\Rector\\Property\\PrivatizeFinalClassPropertyRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php', @@ -2186,7 +2181,6 @@ class ComposerStaticInit0d7ac37abdc3277d2804c7296dfa0f13 'Rector\\RectorInstaller\\LocalFilesystem' => __DIR__ . '/..' . '/rector/extension-installer/src/LocalFilesystem.php', 'Rector\\RectorInstaller\\Plugin' => __DIR__ . '/..' . '/rector/extension-installer/src/Plugin.php', 'Rector\\RectorInstaller\\PluginInstaller' => __DIR__ . '/..' . '/rector/extension-installer/src/PluginInstaller.php', - 'Rector\\Rector\\AbstractCollectorRector' => __DIR__ . '/../..' . '/src/Rector/AbstractCollectorRector.php', 'Rector\\Rector\\AbstractRector' => __DIR__ . '/../..' . '/src/Rector/AbstractRector.php', 'Rector\\Rector\\AbstractScopeAwareRector' => __DIR__ . '/../..' . '/src/Rector/AbstractScopeAwareRector.php', 'Rector\\Reflection\\ClassModifierChecker' => __DIR__ . '/../..' . '/src/Reflection/ClassModifierChecker.php',