Skip to content

Commit bc2860e

Browse files
committed
Handle trailing globstar
1 parent f7e6fad commit bc2860e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/TextUI/Configuration/SourceFilter.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ public function __construct(Source $source)
5050
$this->source = $source;
5151
$this->includeDirectoryRegexes = array_map(static function (FilterDirectory $directory)
5252
{
53-
return [$directory, Glob::toRegEx(self::toGlob($directory))];
53+
return [$directory, self::toGlob($directory)];
5454
}, $source->includeDirectories()->asArray());
5555
$this->excludeDirectoryRegexes = array_map(static function (FilterDirectory $directory)
5656
{
57-
return [$directory, Glob::toRegEx(self::toGlob($directory))];
57+
return [$directory, self::toGlob($directory)];
5858
}, $source->excludeDirectories()->asArray());
5959
}
6060

@@ -95,8 +95,13 @@ public function includes(string $path): bool
9595

9696
public static function toGlob(FilterDirectory $directory): string
9797
{
98-
$glob = sprintf('%s/**/*', $directory->path());
99-
return $glob;
98+
$path = $directory->path();
99+
100+
if (Glob::isDynamic($path)) {
101+
return Glob::toRegEx($path);
102+
}
103+
104+
return Glob::toRegEx(sprintf('%s/**/*', $directory->path()));
100105
}
101106

102107
private static function filenameMatches(FilterDirectory $directory, string $filename): bool

0 commit comments

Comments
 (0)