Skip to content

Commit

Permalink
Use an empty string as fallback for InstallationManager::etInstallPath
Browse files Browse the repository at this point in the history
For Composer 2.5.6+ compatibility
  • Loading branch information
gmazzap committed May 29, 2023
1 parent 7768958 commit a8597ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions src/Asset/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ public static function forAssetConfigInRoot(

/**
* @param PackageInterface $package
* @param string|null $path
* @param string $path
* @param ModeResolver $modeResolver
* @param Filesystem $filesystem
* @param array<string, string> $rootEnv
* @return Config
*/
public static function forComposerPackage(
PackageInterface $package,
?string $path,
string $path,
ModeResolver $modeResolver,
Filesystem $filesystem,
array $rootEnv = []
Expand All @@ -161,11 +161,6 @@ public static function forComposerPackage(
$instance = new static($data, $modeResolver, $rootEnv);
$instance->byPackage = true;
if ($isRoot) {
if (!is_string($path)) {
// This never happens when asset compiler calls this method, but it is a public
// method and the type allows it. So let it throw a telling error.
throw new \Error('Root configuration can not be constructed without a valid path.');
}
$instance->byRootPackage = true;
$name = $package->getName();
$instance->rootConfig = RootConfig::new(
Expand Down
2 changes: 1 addition & 1 deletion src/Asset/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function attemptFactory(
$isRoot = ($package instanceof RootPackageInterface);
$path = $isRoot
? $this->rootDir
: $this->installationManager->getInstallPath($package);
: ($this->installationManager->getInstallPath($package) ?? '');

if (!$config && (!$rootLevelPackageConfig || $packageOrDefaultAllowed)) {
$packageLevelConfig = Config::forComposerPackage(
Expand Down

0 comments on commit a8597ef

Please sign in to comment.