Skip to content

Commit f035847

Browse files
Update to Composer Plugin-API 2.0
1 parent 61b6c50 commit f035847

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
],
1616
"require": {
1717
"php": "^7.1",
18-
"composer-plugin-api": "^1.1",
19-
"captainhook/captainhook": "^4.0"
18+
"composer-plugin-api": "^1.1|^2.0",
19+
"org_heigl/trait-iterator": "^1.1",
20+
"captainhook/captainhook": "^5.0"
2021
},
2122
"require-dev": {
2223
"composer/composer": "*"

src/ComposerPlugin.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,36 @@ public function activate(Composer $composer, IOInterface $io) : void
4040
// nothing to do here
4141
}
4242

43+
/**
44+
* Remove any hooks from Composer
45+
*
46+
* This will be called when a plugin is deactivated before being
47+
* uninstalled, but also before it gets upgraded to a new version
48+
* so the old one can be deactivated and the new one activated.
49+
*
50+
* @param Composer $composer
51+
* @param IOInterface $io
52+
*/
53+
public function deactivate(Composer $composer, IOInterface $io)
54+
{
55+
// Do nothing currently
56+
}
57+
58+
/**
59+
* Prepare the plugin to be uninstalled
60+
*
61+
* This will be called after deactivate.
62+
*
63+
* @param Composer $composer
64+
* @param IOInterface $io
65+
*/
66+
public function uninstall(Composer $composer, IOInterface $io)
67+
{
68+
// Do nothing currently
69+
}
70+
71+
72+
4373
/**
4474
* Make sure the installer is executed after the autoloader is created
4575
*

0 commit comments

Comments
 (0)