Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaellopez/495f205b36647cfc7dcbd70d4de1db8e to your computer and use it in GitHub Desktop.
Save michaellopez/495f205b36647cfc7dcbd70d4de1db8e to your computer and use it in GitHub Desktop.
diff --git a/src/Patches.php b/src/Patches.php
index 70c5b83..ba01d6d 100644
--- a/src/Patches.php
+++ b/src/Patches.php
@@ -8,10 +8,14 @@
namespace cweagans\Composer;
use Composer\Composer;
+use Composer\DependencyResolver\DefaultPolicy;
+use Composer\DependencyResolver\Pool;
+use Composer\DependencyResolver\Request;
use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\OperationInterface;
+use Composer\Repository\CompositeRepository;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\IO\IOInterface;
use Composer\Package\AliasPackage;
@@ -135,7 +139,9 @@ class Patches implements PluginInterface, EventSubscriberInterface {
|| ($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>');
+ $this->eventDispatcher->dispatchPackageEvent(PackageEvents::PRE_PACKAGE_UNINSTALL, $event->isDevMode(), new DefaultPolicy(), new Pool('dev'), new CompositeRepository([$package->getRepository()]), new Request(), [$uninstallOperation], $uninstallOperation);
$installationManager->uninstall($localRepository, $uninstallOperation);
+ $this->eventDispatcher->dispatchPackageEvent(PackageEvents::POST_PACKAGE_UNINSTALL, $event->isDevMode(), new DefaultPolicy(), new Pool('dev'), new CompositeRepository([$package->getRepository()]), new Request(), [$uninstallOperation], $uninstallOperation);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment