Updated Rector to commit b96adc590b9939e14a2abfdda3dd05f5bb1824e1

b96adc590b [Performance] Move realpath() collection early on FilesystemTweaker (part 1) (#6783)
This commit is contained in:
Tomas Votruba 2025-03-15 11:26:57 +00:00
parent 7a39169380
commit 09be5b23df
4 changed files with 22 additions and 7 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '217026caf877c60eb7a7fd61b5b16d9a642f1662';
public const PACKAGE_VERSION = 'b96adc590b9939e14a2abfdda3dd05f5bb1824e1';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2025-03-14 23:18:19';
public const RELEASE_DATE = '2025-03-15 12:24:23';
/**
* @var int
*/

View File

@ -14,7 +14,7 @@ final class FileAndDirectoryFilter
*/
public function filterDirectories(array $filesAndDirectories) : array
{
$directories = \array_filter($filesAndDirectories, static fn(string $path): bool => \is_dir($path) && \realpath($path) !== \false);
$directories = \array_filter($filesAndDirectories, static fn(string $path): bool => \is_dir($path));
return \array_values($directories);
}
/**
@ -23,7 +23,7 @@ final class FileAndDirectoryFilter
*/
public function filterFiles(array $filesAndDirectories) : array
{
$files = \array_filter($filesAndDirectories, static fn(string $path): bool => \is_file($path) && \realpath($path) !== \false);
$files = \array_filter($filesAndDirectories, static fn(string $path): bool => \is_file($path));
return \array_values($files);
}
}

View File

@ -59,7 +59,6 @@ final class FilesFinder
$filesAndDirectories = $this->filesystemTweaker->resolveWithFnmatch($source);
// filtering files in files collection
$filteredFilePaths = $this->fileAndDirectoryFilter->filterFiles($filesAndDirectories);
$filteredFilePaths = \array_map(fn(string $filePath): string => \realpath($filePath), $filteredFilePaths);
$filteredFilePaths = \array_filter($filteredFilePaths, fn(string $filePath): bool => !$this->pathSkipper->shouldSkip($filePath));
// fallback append `.php` to be used for both $filteredFilePaths and $filteredFilePathsInDirectories
$hasOnlySuffix = $onlySuffix !== null && $onlySuffix !== '';

View File

@ -18,13 +18,29 @@ final class FilesystemTweaker
foreach ($paths as $path) {
if (\strpos($path, '*') !== \false) {
$foundPaths = $this->foundInGlob($path);
$absolutePathsFound = \array_merge($absolutePathsFound, $foundPaths);
$absolutePathsFound = $this->appendPaths($foundPaths, $absolutePathsFound);
} else {
$absolutePathsFound[] = $path;
$absolutePathsFound = $this->appendPaths([$path], $absolutePathsFound);
}
}
return $absolutePathsFound;
}
/**
* @param string[] $foundPaths
* @param string[] $absolutePathsFound
* @return string[]
*/
private function appendPaths(array $foundPaths, array $absolutePathsFound) : array
{
foreach ($foundPaths as $foundPath) {
$foundPath = \realpath($foundPath);
if ($foundPath === \false) {
continue;
}
$absolutePathsFound[] = $foundPath;
}
return $absolutePathsFound;
}
/**
* @return string[]
*/