Skip to content

Commit 587f052

Browse files
committed
fix: uninstall hook
1 parent 4e28eba commit 587f052

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Cook.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
final class Cook implements PluginInterface, Capable, EventSubscriberInterface, CommandProvider
2020
{
2121
private array $newPackages = [];
22-
private array $packagesToRemove = [];
2322
private ?ServiceContainer $serviceContainer = null;
2423
private Composer $composer;
2524
private IOInterface $io;
@@ -74,15 +73,16 @@ public function addNewPackage(PackageEvent $event): void
7473

7574
public function removePackage(PackageEvent $event): void
7675
{
77-
$this->packagesToRemove[] = $event->getOperation()
76+
$package = $event->getOperation()
7877
->getPackage()
7978
->getName();
79+
80+
$this->uninstallRecipe($package);
8081
}
8182

8283
public function postUpdate(): void
8384
{
8485
$this->executeRecipes();
85-
$this->uninstallRecipes();
8686
$this->displayPostInstallOutput();
8787
}
8888

@@ -102,11 +102,11 @@ private function executeRecipes(): void
102102
?->cookRecipes($this->newPackages);
103103
}
104104

105-
private function uninstallRecipes(): void
105+
private function uninstallRecipe(string $package): void
106106
{
107107
$this->getServiceContainer()
108108
->get(Oven::class)
109-
?->uninstallRecipes($this->packagesToRemove);
109+
?->uninstallRecipes([$package]);
110110
}
111111

112112
private function displayPostInstallOutput(): void

0 commit comments

Comments
 (0)