From 7ee3bb5cd61ac2f9b26d74b3b2efc71ca801e4eb Mon Sep 17 00:00:00 2001 From: Ayesh Karunaratne Date: Tue, 14 Apr 2020 15:42:35 +0700 Subject: [PATCH] Add support for Composer version 2 Composer version 2 has `composer-plugin-api` version 2. This PR updates the version constraint to `^1 || ^2` so we can support both composer versions. See [What's new in Composer 2](https://php.watch/articles/composer-2) and [UPGRADE-2.0](https://github.com/composer/composer/blob/master/UPGRADE-2.0.md#for-integrators-and-plugin-authors) for more changes in API. Empty methods \cweagans\Composer\Plugin\Patches::deactivate() and \cweagans\Composer\Plugin\Patches::uninstall are added to make it compatible both versions. --- composer.json | 2 +- src/Plugin/Patches.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8de34b3c..ce434347 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "require": { "php": ">=5.6.0", "ext-json": "*", - "composer-plugin-api": "^1.0", + "composer-plugin-api": "^1.0 || ^2.0", "cweagans/composer-configurable-plugin": "^1.0" }, "require-dev": { diff --git a/src/Plugin/Patches.php b/src/Plugin/Patches.php index 40a43e07..20ff0b41 100644 --- a/src/Plugin/Patches.php +++ b/src/Plugin/Patches.php @@ -511,4 +511,18 @@ protected function executeCommand($cmd) } return ($this->executor->execute($command, $output) === 0); } + + /** + * {@inheritDoc} + */ + public function deactivate(Composer $composer, IOInterface $io) + { + } + + /** + * {@inheritDoc} + */ + public function uninstall(Composer $composer, IOInterface $io) + { + } }