Skip to content

Commit

Permalink
Merge pull request #137 from tighten/drift/add-support-for-additional…
Browse files Browse the repository at this point in the history
…-suffixes

Add support for additional suffixes
  • Loading branch information
driftingly authored Dec 15, 2023
2 parents a184db3 + 86d9e29 commit 3e20721
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions app/Support/DusterConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@

class DusterConfig
{
/**
* @var array<int, string>
*/
public static array $phpSuffixes = [
'.php',
'.php.inc',
'.php.stub',
'.php.skeleton',
];

/**
* @param array<string, array<int, string>|string> $config
*/
Expand Down Expand Up @@ -78,8 +88,8 @@ public static function globPath(string $path): array
// Finder uses forward slashes even on windows
$path = Str::of($path)->replace('\\', '/')->__toString();

if (Str::of($path)->endsWith('.php')) {
$name = Str::of($path)->afterLast('/');
if (Str::of($path)->endsWith(self::$phpSuffixes)) {
$endsWith = Str::of($path)->afterLast('/');
$path = Str::of($path)->beforeLast('/');

$files = (new Finder)
Expand All @@ -88,7 +98,7 @@ public static function globPath(string $path): array
->files()
->in($path);
} else {
$name = '.php';
$endsWith = self::$phpSuffixes;
$files = (new Finder)
->ignoreUnreadableDirs()
->files()
Expand All @@ -97,7 +107,7 @@ public static function globPath(string $path): array

return collect($files)
->map(
fn ($file) => Str::of($file->getPathName())->endsWith($name)
fn ($file) => Str::of($file->getPathName())->endsWith($endsWith)
// Fixes weird windows path issue with mixed slashes
? Str::of($file->getPathName())->replace('\\', '/')->__toString()
: null
Expand Down
Binary file modified builds/duster
Binary file not shown.
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
|
*/

'version' => '2.7.0',
'version' => '2.7.1',

/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit 3e20721

Please sign in to comment.