From a537c0fb194430d2f79df10094d99c0e17dd565f Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 6 Jan 2025 18:47:04 +0100 Subject: [PATCH] Simplify FileIteratorSourceLocator --- src/SourceLocator/Type/FileIteratorSourceLocator.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/SourceLocator/Type/FileIteratorSourceLocator.php b/src/SourceLocator/Type/FileIteratorSourceLocator.php index dcd9cc0f0..e59024dff 100644 --- a/src/SourceLocator/Type/FileIteratorSourceLocator.php +++ b/src/SourceLocator/Type/FileIteratorSourceLocator.php @@ -18,9 +18,6 @@ use function array_map; use function array_values; use function iterator_to_array; -use function pathinfo; - -use const PATHINFO_EXTENSION; /** * This source locator loads all php files from \FileSystemIterator @@ -56,13 +53,11 @@ private function getAggregatedSourceLocator(): AggregateSourceLocator return $this->aggregateSourceLocator ?? $this->aggregateSourceLocator = new AggregateSourceLocator(array_values(array_filter(array_map( function (SplFileInfo $item): SingleFileSourceLocator|null { - $realPath = $item->getRealPath(); - - if (! ($item->isFile() && pathinfo($realPath, PATHINFO_EXTENSION) === 'php')) { + if (! ($item->isFile() && $item->getExtension() === 'php')) { return null; } - return new SingleFileSourceLocator($realPath, $this->astLocator); + return new SingleFileSourceLocator($item->getRealPath(), $this->astLocator); }, iterator_to_array($this->fileSystemIterator), ))));