Skip to content

Commit

Permalink
Fix feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Nov 25, 2021
1 parent 4352f23 commit a6fc1ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
12 changes: 3 additions & 9 deletions src/Composer/DependencyResolver/PoolBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ public function buildPool(array $repositories, Request $request)

foreach ($request->getLockedRepository()->getPackages() as $lockedPackage) {
if (!$this->isUpdateAllowed($lockedPackage)) {
$lockedName = $lockedPackage->getName();

// remember which packages we skipped loading remote content for in this partial update
$this->skippedLoad[$lockedPackage->getName()][] = $lockedPackage;
foreach ($lockedPackage->getReplaces() as $link) {
Expand Down Expand Up @@ -624,7 +622,7 @@ private function unlockPackage(Request $request, array $repositories, $name)
if (isset($this->pathRepoUnlocked[$name])) {
foreach ($this->packages as $index => $package) {
if ($package->getName() === $name) {
$this->removeLoadedPackage($request, $repositories, $package, $index, false);
$this->removeLoadedPackage($request, $repositories, $package, $index);
}
}
}
Expand All @@ -636,7 +634,7 @@ private function unlockPackage(Request $request, array $repositories, $name)
if (!($lockedPackage instanceof AliasPackage) && $lockedPackage->getName() === $name) {
if (false !== $index = array_search($lockedPackage, $this->packages, true)) {
$request->unlockPackage($lockedPackage);
$this->removeLoadedPackage($request, $repositories, $lockedPackage, $index, true);
$this->removeLoadedPackage($request, $repositories, $lockedPackage, $index);

// make sure that any requirements for this package by other locked or fixed packages are now
// also loaded, as they were previously ignored because the locked (now unlocked) package already
Expand All @@ -661,20 +659,16 @@ private function unlockPackage(Request $request, array $repositories, $name)
/**
* @param RepositoryInterface[] $repositories
* @param int $index
* @param bool $unlock
* @return void
*/
private function removeLoadedPackage(Request $request, array $repositories, BasePackage $package, $index, $unlock)
private function removeLoadedPackage(Request $request, array $repositories, BasePackage $package, $index)
{
$repoIndex = array_search($package->getRepository(), $repositories, true);

unset($this->loadedPerRepo[$repoIndex][$package->getName()][$package->getVersion()]);
unset($this->packages[$index]);
if (isset($this->aliasMap[spl_object_hash($package)])) {
foreach ($this->aliasMap[spl_object_hash($package)] as $aliasIndex => $aliasPackage) {
if ($unlock) {
$request->unlockPackage($aliasPackage);
}
unset($this->loadedPerRepo[$repoIndex][$aliasPackage->getName()][$aliasPackage->getVersion()]);
unset($this->packages[$aliasIndex]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Partially updating one root requirement with transitive deps fully updates trans
"mirrored/path-pkg": "*"
}
}

--LOCK--
{
"packages": [
Expand Down Expand Up @@ -66,13 +67,7 @@ Partially updating one root requirement with transitive deps fully updates trans
"platform": [],
"platform-dev": []
}
--INSTALLED--
[
{ "name": "a/old", "version": "0.9.0" },
{ "name": "b/unstable", "version": "1.1.0-alpha", "require": {"f/dependency": "1.*"} },
{ "name": "c/uptodate", "version": "2.0.0" },
{ "name": "f/dependency", "version": "1.0.0" }
]

--RUN--
update --with-all-dependencies root/update

Expand Down

0 comments on commit a6fc1ab

Please sign in to comment.