diff --git a/lib/Iterator/ClassMapIterator.php b/lib/Iterator/ClassMapIterator.php index f4e7699..07b25c4 100644 --- a/lib/Iterator/ClassMapIterator.php +++ b/lib/Iterator/ClassMapIterator.php @@ -45,7 +45,7 @@ static function (string $path): void { foreach ($this->classMap as $className => $path) { $path = PathNormalizer::resolvePath($path); - if ($this->pathCallback && ! ($this->pathCallback)($path)) { + if ($this->pathCallback && ! ($this->pathCallback)(PathNormalizer::normalize($path))) { continue; } diff --git a/lib/Iterator/FilteredComposerIterator.php b/lib/Iterator/FilteredComposerIterator.php index bad886b..f813162 100644 --- a/lib/Iterator/FilteredComposerIterator.php +++ b/lib/Iterator/FilteredComposerIterator.php @@ -95,7 +95,7 @@ private function searchInClassMap(): Generator continue; } - if ($this->pathCallback && ! ($this->pathCallback)($file)) { + if ($this->pathCallback && ! ($this->pathCallback)(PathNormalizer::normalize($file))) { continue; } diff --git a/lib/Iterator/OfflineIteratorTrait.php b/lib/Iterator/OfflineIteratorTrait.php index 4957cc5..31a913b 100644 --- a/lib/Iterator/OfflineIteratorTrait.php +++ b/lib/Iterator/OfflineIteratorTrait.php @@ -77,7 +77,7 @@ public function notPath(array $patterns): self private function accept(string $path): bool { - if ($this->pathCallback && ! ($this->pathCallback)($path)) { + if ($this->pathCallback && ! ($this->pathCallback)(PathNormalizer::normalize($path))) { return false; } diff --git a/lib/Iterator/Psr0Iterator.php b/lib/Iterator/Psr0Iterator.php index 76ce3e4..7e2a73b 100644 --- a/lib/Iterator/Psr0Iterator.php +++ b/lib/Iterator/Psr0Iterator.php @@ -80,7 +80,7 @@ class_exists($class, true); continue; } - if ($this->pathCallback && ! ($this->pathCallback)($path)) { + if ($this->pathCallback && ! ($this->pathCallback)(PathNormalizer::normalize($path))) { continue; } diff --git a/lib/Iterator/Psr4Iterator.php b/lib/Iterator/Psr4Iterator.php index f759679..784e90c 100644 --- a/lib/Iterator/Psr4Iterator.php +++ b/lib/Iterator/Psr4Iterator.php @@ -80,7 +80,7 @@ class_exists($class, true); continue; } - if ($this->pathCallback && ! ($this->pathCallback)($path)) { + if ($this->pathCallback && ! ($this->pathCallback)(PathNormalizer::normalize($path))) { continue; } diff --git a/lib/Iterator/RecursiveIterator.php b/lib/Iterator/RecursiveIterator.php index 5855b18..95a7062 100644 --- a/lib/Iterator/RecursiveIterator.php +++ b/lib/Iterator/RecursiveIterator.php @@ -40,7 +40,7 @@ protected function getGenerator(): Generator continue; } - if ($this->pathCallback && ! ($this->pathCallback)($path)) { + if ($this->pathCallback && ! ($this->pathCallback)(PathNormalizer::normalize($path))) { continue; } diff --git a/lib/PathNormalizer.php b/lib/PathNormalizer.php index eed5ac4..88afca3 100644 --- a/lib/PathNormalizer.php +++ b/lib/PathNormalizer.php @@ -14,6 +14,14 @@ final class PathNormalizer { + /** + * Normalizes path separator to '/'. + */ + public static function normalize(string $path): string + { + return str_replace(DIRECTORY_SEPARATOR, '/', $path); + } + /** * Resolve a path. *