Skip to content

Commit

Permalink
Updated Rector to commit 5a3a59c50c7810296274eb4408737c8f2f8921e7
Browse files Browse the repository at this point in the history
rectorphp/rector-src@5a3a59c Remove collectors, as performance very costly and not practically useful (rectorphp#5470)
  • Loading branch information
TomasVotruba committed Jan 15, 2024
1 parent e24202f commit ec3d78e
Show file tree
Hide file tree
Showing 22 changed files with 12 additions and 484 deletions.
1 change: 0 additions & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
$rectorConfig->autoloadPaths([]);
$rectorConfig->bootstrapFiles([]);
$rectorConfig->parallel();
$rectorConfig->disableCollectors();
// to avoid autoimporting out of the box
$rectorConfig->importNames(\false, \false);
$rectorConfig->removeUnusedImports(\false);
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion src/Application/ApplicationFileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ public function processFiles(array $filePaths, Configuration $configuration, ?ca
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);
Expand Down
66 changes: 0 additions & 66 deletions src/Application/Collector/CollectorNodeVisitor.php

This file was deleted.

38 changes: 0 additions & 38 deletions src/Application/Collector/CollectorProcessor.php

This file was deleted.

19 changes: 3 additions & 16 deletions src/Application/FileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
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;
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -90,22 +84,17 @@ public function __construct(FormatPerservingPrinter $formatPerservingPrinter, Re
$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();
Expand All @@ -114,8 +103,6 @@ public function processFile(File $file, Configuration $configuration) : FileProc
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()"
Expand All @@ -138,7 +125,7 @@ public function processFile(File $file, Configuration $configuration) : FileProc
$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
{
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
45 changes: 0 additions & 45 deletions src/Collector/MockedClassCollector.php

This file was deleted.

Loading

0 comments on commit ec3d78e

Please sign in to comment.