From 8bb472a6089a14f58648fff8924c49a79c8545ec Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 17 Jan 2020 14:51:26 +0100 Subject: [PATCH] No need to alias platform packages before the repository set as the pool builder already does it --- .../DependencyResolver/PoolBuilder.php | 1 - src/Composer/Installer.php | 21 ------------------- 2 files changed, 22 deletions(-) diff --git a/src/Composer/DependencyResolver/PoolBuilder.php b/src/Composer/DependencyResolver/PoolBuilder.php index cb6a34947..1be0522a6 100644 --- a/src/Composer/DependencyResolver/PoolBuilder.php +++ b/src/Composer/DependencyResolver/PoolBuilder.php @@ -170,7 +170,6 @@ class PoolBuilder $aliasPackage = new AliasPackage($basePackage, $alias['alias_normalized'], $alias['alias']); $aliasPackage->setRootPackageAlias(true); - $package->getRepository()->addPackage($aliasPackage); // TODO do we need this? $this->packages[] = $aliasPackage; $this->aliasMap[spl_object_hash($aliasPackage->getAliasOf())][$index+1] = $aliasPackage; } diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 9f831ef8f..9ed7f2d8e 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -697,8 +697,6 @@ class Installer */ private function createRepositorySet(PlatformRepository $platformRepo, array $rootAliases = array(), $lockedRepository = null) { - $this->aliasPlatformPackages($platformRepo, $rootAliases); - // TODO what's the point of rootConstraints at all, we generate the package pool taking them into account anyway? // TODO maybe we can drop the lockedRepository here // TODO if this gets called in doInstall, this->update is still true?! @@ -830,25 +828,6 @@ class Installer return $normalizedAliases; } - /** - * @param PlatformRepository $platformRepo - * @param array $aliases - */ - private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases) - { - // TODO should the repository set do this? - foreach ($aliases as $packageName => $versions) { - foreach ($versions as $version => $alias) { - $packages = $platformRepo->findPackages($packageName, $version); - foreach ($packages as $package) { - $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']); - $aliasPackage->setRootPackageAlias(true); - $platformRepo->addPackage($aliasPackage); - } - } - } - } - /** * @param PackageInterface $package * @return bool