Skip to content

Commit d0ffe16

Browse files
authored
Revert "[10.x] Update Kernel::load() to use same classFromFile logic as events (#47327)" (#47382)
This reverts commit 2b174d5.
1 parent 56ad777 commit d0ffe16

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/Illuminate/Foundation/Console/Kernel.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,12 @@ protected function load($paths)
332332
}
333333

334334
$namespace = $this->app->getNamespace();
335-
$basePath = $this->app->basePath();
336335

337-
foreach ((new Finder())->in($paths)->files() as $file) {
338-
$class = trim(Str::replaceFirst($basePath, '', $file->getRealPath()), DIRECTORY_SEPARATOR);
339-
340-
$command = str_replace(
341-
[DIRECTORY_SEPARATOR, ucfirst(basename($this->app->path())).'\\'],
342-
['\\', $namespace],
343-
ucfirst(Str::replaceLast('.php', '', $class)),
336+
foreach ((new Finder)->in($paths)->files() as $command) {
337+
$command = $namespace.str_replace(
338+
['/', '.php'],
339+
['\\', ''],
340+
Str::after($command->getRealPath(), realpath(app_path()).DIRECTORY_SEPARATOR)
344341
);
345342

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

0 commit comments

Comments
 (0)