Skip to content

Commit

Permalink
Remove AffectedFilesCount as unused (#4094)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jun 6, 2023
1 parent 701278e commit b852d70
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 48 deletions.
37 changes: 0 additions & 37 deletions packages/ChangesReporting/Collector/AffectedFilesCollector.php

This file was deleted.

10 changes: 1 addition & 9 deletions src/Application/FileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@

namespace Rector\Core\Application;

use Rector\ChangesReporting\Collector\AffectedFilesCollector;
use Rector\Core\PhpParser\NodeTraverser\FileWithoutNamespaceNodeTraverser;
use Rector\Core\PhpParser\NodeTraverser\RectorNodeTraverser;
use Rector\Core\PhpParser\Parser\RectorParser;
use Rector\Core\ValueObject\Application\File;
use Rector\Core\ValueObject\Configuration;
use Rector\NodeTypeResolver\NodeScopeAndMetadataDecorator;

final class FileProcessor
{
public function __construct(
private readonly AffectedFilesCollector $affectedFilesCollector,
private readonly NodeScopeAndMetadataDecorator $nodeScopeAndMetadataDecorator,
private readonly RectorParser $rectorParser,
private readonly RectorNodeTraverser $rectorNodeTraverser,
Expand All @@ -35,16 +32,11 @@ public function parseFileInfoToLocalCache(File $file): void
$file->hydrateStmtsAndTokens($newStmts, $oldStmts, $oldTokens);
}

public function refactor(File $file, Configuration $configuration): void
public function refactor(File $file): void
{
$newStmts = $this->fileWithoutNamespaceNodeTraverser->traverse($file->getNewStmts());
$newStmts = $this->rectorNodeTraverser->traverse($newStmts);

$file->changeNewStmts($newStmts);

$this->affectedFilesCollector->removeFromList($file);
while (($otherTouchedFile = $this->affectedFilesCollector->getNext()) instanceof File) {
$this->refactor($otherTouchedFile, $configuration);
}
}
}
2 changes: 1 addition & 1 deletion src/Application/FileProcessor/PhpFileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function process(File $file, Configuration $configuration): array
$rectorWithLineChanges = null;
do {
$file->changeHasChanged(false);
$this->fileProcessor->refactor($file, $configuration);
$this->fileProcessor->refactor($file);

// 3. apply post rectors
$newStmts = $this->postFileProcessor->traverse($file->getNewStmts());
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/RectorKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class RectorKernel
/**
* @var string
*/
private const CACHE_KEY = 'v62';
private const CACHE_KEY = 'v63';

private ContainerInterface|null $container = null;

Expand Down

0 comments on commit b852d70

Please sign in to comment.