Skip to content

Commit 12a8074

Browse files
committed
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 `\johnpbloch\Composer\WordPressCorePlugin::deactivate()` and `\johnpbloch\Composer\WordPressCorePlugin::uninstall()` are added to make it compatible both versions.
1 parent ec541ae commit 12a8074

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
"class": "johnpbloch\\Composer\\WordPressCorePlugin"
2929
},
3030
"require": {
31-
"composer-plugin-api": "^1.0"
31+
"composer-plugin-api": "^1.0 || ^2.0"
3232
},
3333
"require-dev": {
34-
"composer/composer": "^1.0",
34+
"composer/composer": "^1.0 || ^2.0",
3535
"phpunit/phpunit": ">=4.8.35"
3636
},
3737
"conflict": {

src/johnpbloch/Composer/WordPressCorePlugin.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,16 @@ public function activate( Composer $composer, IOInterface $io ) {
3838
$composer->getInstallationManager()->addInstaller( $installer );
3939
}
4040

41+
/**
42+
* {@inheritDoc}
43+
*/
44+
public function deactivate( Composer $composer, IOInterface $io ) {
45+
}
46+
47+
/**
48+
* {@inheritDoc}
49+
*/
50+
public function uninstall( Composer $composer, IOInterface $io ) {
51+
}
52+
4153
}

0 commit comments

Comments
 (0)