Skip to content

Commit

Permalink
Merge pull request #366 from Seldaek/fix-composer2.1
Browse files Browse the repository at this point in the history
Add support for Promises being returned by uninstall in Composer 2.1
  • Loading branch information
cweagans committed Jun 8, 2021
2 parents 30707e7 + dc9bcd6 commit 9888dcc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Patches.php
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 9888dcc

Please sign in to comment.