diff --git a/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php b/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php index 1c1da9bd..2757a132 100644 --- a/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php +++ b/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php @@ -12,7 +12,6 @@ use function implode; use function preg_match; use function preg_quote; -use function preg_replace; use function str_replace; use function trim; @@ -79,14 +78,9 @@ private function prepareBlacklistPatterns(array|null $blacklistPaths): array $dirSep = preg_quote(DIRECTORY_SEPARATOR, '{}'); foreach ($blacklistPaths as &$path) { - $path = preg_replace( - '{' . $dirSep . '+}', - DIRECTORY_SEPARATOR, - preg_quote( - trim(str_replace('/', DIRECTORY_SEPARATOR, $path), DIRECTORY_SEPARATOR), - '{}', - ), - ); + $path = str_replace('/', DIRECTORY_SEPARATOR, $path); + $path = trim($path, DIRECTORY_SEPARATOR); + $path = preg_quote($path, '{}'); $path = str_replace('\\*\\*', '.+?', $path); $path = str_replace('\\*', '[^' . $dirSep . ']+?', $path); }