Skip to content

Commit 8d4eaeb

Browse files
Use a static function (#49696)
1 parent 4d8c49f commit 8d4eaeb

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/Illuminate/Console/GeneratorCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ protected function possibleModels()
249249
{
250250
$modelPath = is_dir(app_path('Models')) ? app_path('Models') : app_path();
251251

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

272-
return collect((new Finder)->files()->depth(0)->in($eventPath))
272+
return collect(Finder::create()->files()->depth(0)->in($eventPath))
273273
->map(fn ($file) => $file->getBasename('.php'))
274274
->sort()
275275
->values()

src/Illuminate/Database/Console/PruneCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ protected function models()
126126
throw new InvalidArgumentException('The --models and --except options cannot be combined.');
127127
}
128128

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

src/Illuminate/Foundation/Console/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ protected function load($paths)
340340

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

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

346346
if (is_subclass_of($command, Command::class) &&

src/Illuminate/Foundation/Events/DiscoverEvents.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DiscoverEvents
2929
public static function within($listenerPath, $basePath)
3030
{
3131
$listeners = collect(static::getListenerEvents(
32-
(new Finder)->files()->in($listenerPath), $basePath
32+
Finder::create()->files()->in($listenerPath), $basePath
3333
));
3434

3535
$discoveredEvents = [];

0 commit comments

Comments
 (0)