From 78d7792eb810319f86421071bf795ce41eca24f2 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 10 Feb 2021 10:03:44 +0100 Subject: [PATCH] Fix handling of promises for uninstall step when updating to a different install source --- src/Composer/Installer/InstallationManager.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Composer/Installer/InstallationManager.php b/src/Composer/Installer/InstallationManager.php index f8a0e5708..01148583a 100644 --- a/src/Composer/Installer/InstallationManager.php +++ b/src/Composer/Installer/InstallationManager.php @@ -492,9 +492,15 @@ class InstallationManager $promise = $installer->update($repo, $initial, $target); $this->markForNotification($target); } else { - $this->getInstaller($initialType)->uninstall($repo, $initial); + $promise = $this->getInstaller($initialType)->uninstall($repo, $initial); + if (!$promise instanceof PromiseInterface) { + $promise = \React\Promise\resolve(); + } + $installer = $this->getInstaller($targetType); - $promise = $installer->install($repo, $target); + $promise->then(function () use ($installer, $repo, $target) { + return $installer->install($repo, $target); + }); } return $promise;