Skip to content

Commit

Permalink
Add support for Promises being returned by uninstall in Composer 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Jun 8, 2021
1 parent 30707e7 commit dc9bcd6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Patches.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public function checkPatches(Event $event) {
}

// Remove packages for which the patch set has changed.
$promises = array();
foreach ($packages as $package) {
if (!($package instanceof AliasPackage)) {
$package_name = $package->getName();
Expand All @@ -135,10 +136,14 @@ public function checkPatches(Event $event) {
|| ($has_patches && $has_applied_patches && $tmp_patches[$package_name] !== $extra['patches_applied'])) {
$uninstallOperation = new UninstallOperation($package, 'Removing package so it can be re-installed and re-patched.');
$this->io->write('<info>Removing package ' . $package_name . ' so that it can be re-installed and re-patched.</info>');
$installationManager->uninstall($localRepository, $uninstallOperation);
$promises[] = $installationManager->uninstall($localRepository, $uninstallOperation);
}
}
}
$promises = array_filter($promises);
if ($promises) {
$this->composer->getLoop()->wait($promises);
}
}
// If the Locker isn't available, then we don't need to do this.
// It's the first time packages have been installed.
Expand Down

0 comments on commit dc9bcd6

Please sign in to comment.