Skip to content

Commit

Permalink
Do not try to discover module dependencies for metapackages
Browse files Browse the repository at this point in the history
Composer metapackages are not installed same way as other packages. With
no install location there is nothing to discover.

Starting with composer 2.5.6 the return type for
`Composer\Installer\InstallationManager::getInstallPath()` method becomes nullable.
This fixes type error produced for metapackages with defined extras.

Signed-off-by: Aleksei Khudiakov <aleksey@xerkus.pro>
  • Loading branch information
Xerkus committed May 24, 2023
1 parent 24d4da5 commit 2329e57
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ComponentInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,12 @@ private function loadModuleClassesDependencies(PackageInterface $package): array
$installer = $this->composer->getInstallationManager();
$packagePath = $installer->getInstallPath($package);

/** @psalm-suppress TypeDoesNotContainNull Package path become nullable in composer 2.5.6 */
if ($packagePath === null || $packagePath === '') {
// Do not try to discover dependencies for metapackage and other
// potential package types that have no install location.
return [];
}
$this->mapAutoloaders($package->getAutoload(), $dependencies, $packagePath);

return $dependencies->getArrayCopy();
Expand Down

0 comments on commit 2329e57

Please sign in to comment.