Skip to content

Commit

Permalink
fix: filter vendor paths from registered loaders in Application::infe…
Browse files Browse the repository at this point in the history
…rBasePath
  • Loading branch information
calebdw committed Jan 9, 2025
1 parent 36a4a53 commit 4f3c412
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
*
* @var string
*/
const VERSION = '11.37.0';
public const VERSION = '11.37.0';

/**
* The base path for the Laravel installation.
Expand Down Expand Up @@ -254,7 +254,10 @@ public static function inferBasePath()
{
return match (true) {
isset($_ENV['APP_BASE_PATH']) => $_ENV['APP_BASE_PATH'],
default => dirname(array_keys(ClassLoader::getRegisteredLoaders())[0]),
default => dirname(array_values(array_filter(
array_keys(ClassLoader::getRegisteredLoaders()),
fn ($path) => ! str_contains($path, '/vendor/'),
))[0]),
};
}

Expand Down Expand Up @@ -283,7 +286,9 @@ protected function registerBaseBindings()
$this->singleton(Mix::class);

$this->singleton(PackageManifest::class, fn () => new PackageManifest(
new Filesystem, $this->basePath(), $this->getCachedPackagesPath()
new Filesystem(),
$this->basePath(),
$this->getCachedPackagesPath()
));
}

Expand Down Expand Up @@ -328,7 +333,8 @@ public function bootstrapWith(array $bootstrappers)
public function afterLoadingEnvironment(Closure $callback)
{
$this->afterBootstrapping(
LoadEnvironmentVariables::class, $callback
LoadEnvironmentVariables::class,
$callback
);
}

Expand Down Expand Up @@ -763,7 +769,7 @@ public function detectEnvironment(Closure $callback)
? $_SERVER['argv']
: null;

return $this['env'] = (new EnvironmentDetector)->detect($callback, $args);
return $this['env'] = (new EnvironmentDetector())->detect($callback, $args);
}

/**
Expand Down Expand Up @@ -841,7 +847,7 @@ public function registerConfiguredProviders()

$providers->splice(1, 0, [$this->make(PackageManifest::class)->providers()]);

(new ProviderRepository($this, new Filesystem, $this->getCachedServicesPath()))
(new ProviderRepository($this, new Filesystem(), $this->getCachedServicesPath()))
->load($providers->collapse()->toArray());

$this->fireAppCallbacks($this->registeredCallbacks);
Expand Down Expand Up @@ -1204,7 +1210,7 @@ public function handleCommand(InputInterface $input)

$status = $kernel->handle(
$input,
new ConsoleOutput
new ConsoleOutput()
);

$kernel->terminate($input, $status);
Expand Down

0 comments on commit 4f3c412

Please sign in to comment.