Skip to content

Commit

Permalink
Use a static function (#49696)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelnabil230 authored Jan 16, 2024
1 parent 4d8c49f commit 8d4eaeb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Console/GeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ protected function possibleModels()
{
$modelPath = is_dir(app_path('Models')) ? app_path('Models') : app_path();

return collect((new Finder)->files()->depth(0)->in($modelPath))
return collect(Finder::create()->files()->depth(0)->in($modelPath))
->map(fn ($file) => $file->getBasename('.php'))
->sort()
->values()
Expand All @@ -269,7 +269,7 @@ protected function possibleEvents()
return [];
}

return collect((new Finder)->files()->depth(0)->in($eventPath))
return collect(Finder::create()->files()->depth(0)->in($eventPath))
->map(fn ($file) => $file->getBasename('.php'))
->sort()
->values()
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Console/PruneCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected function models()
throw new InvalidArgumentException('The --models and --except options cannot be combined.');
}

return collect((new Finder)->in($this->getPath())->files()->name('*.php'))
return collect(Finder::create()->in($this->getPath())->files()->name('*.php'))
->map(function ($model) {
$namespace = $this->laravel->getNamespace();

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ protected function load($paths)

$namespace = $this->app->getNamespace();

foreach ((new Finder)->in($paths)->files() as $file) {
foreach (Finder::create()->in($paths)->files() as $file) {
$command = $this->commandClassFromFile($file, $namespace);

if (is_subclass_of($command, Command::class) &&
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Events/DiscoverEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DiscoverEvents
public static function within($listenerPath, $basePath)
{
$listeners = collect(static::getListenerEvents(
(new Finder)->files()->in($listenerPath), $basePath
Finder::create()->files()->in($listenerPath), $basePath
));

$discoveredEvents = [];
Expand Down

0 comments on commit 8d4eaeb

Please sign in to comment.