Skip to content

Commit

Permalink
[DX] Avoid direct SmartFileSystem sanitizer (#2855)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Aug 30, 2022
1 parent 3921c84 commit f702d1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 2 additions & 5 deletions src/Bootstrap/RectorConfigsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Rector\Core\ValueObject\Bootstrap\BootstrapConfigs;
use Symfony\Component\Console\Input\ArgvInput;
use Symplify\SmartFileSystem\Exception\FileNotFoundException;
use Webmozart\Assert\Assert;

final class RectorConfigsResolver
{
Expand Down Expand Up @@ -47,10 +47,7 @@ private function resolveFromInput(ArgvInput $argvInput): ?string
return null;
}

if (! file_exists($configFile)) {
$message = sprintf('File "%s" was not found', $configFile);
throw new FileNotFoundException($message);
}
Assert::fileExists($configFile);

return realpath($configFile);
}
Expand Down
7 changes: 4 additions & 3 deletions src/FileSystem/FilesFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Symfony\Component\Finder\SplFileInfo;
use Symplify\Skipper\SkipCriteriaResolver\SkippedPathsResolver;
use Symplify\SmartFileSystem\FileSystemFilter;
use Symplify\SmartFileSystem\Finder\FinderSanitizer;
use Symplify\SmartFileSystem\SmartFileInfo;

/**
Expand All @@ -32,7 +31,6 @@ final class FilesFinder

public function __construct(
private readonly FilesystemTweaker $filesystemTweaker,
private readonly FinderSanitizer $finderSanitizer,
private readonly FileSystemFilter $fileSystemFilter,
private readonly SkippedPathsResolver $skippedPathsResolver,
private readonly UnchangedFilesFilter $unchangedFilesFilter,
Expand Down Expand Up @@ -81,7 +79,10 @@ private function findInDirectories(array $directories, array $suffixes): array

$this->addFilterWithExcludedPaths($finder);

$smartFileInfos = $this->finderSanitizer->sanitize($finder);
$smartFileInfos = [];
foreach ($finder as $fileInfo) {
$smartFileInfos[] = new SmartFileInfo($fileInfo->getRealPath());
}

return $this->unchangedFilesFilter->filterAndJoinWithDependentFileInfos($smartFileInfos);
}
Expand Down

0 comments on commit f702d1c

Please sign in to comment.