Skip to content

Commit a0d31bd

Browse files
committed
Bump minimum Composer version to 1.1
Long overdue follow up to 586ae1e which raises the minimum supported Composer version to 1.1 (released May 10, 2016). This allows removing our local MergePlugin::COMPAT_PLUGINEVENTS_INIT const and instead using the Composer provided Composer\Plugin\PluginEvents::INIT const.
1 parent 841279f commit a0d31bd

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
"minimum-stability": "dev",
1313
"prefer-stable": true,
1414
"require": {
15-
"composer-plugin-api": "^1.0",
15+
"composer-plugin-api": "^1.1",
1616
"php": ">=7.2.0"
1717
},
1818
"require-dev": {
19-
"composer/composer": "^1.0",
19+
"composer/composer": "^1.1",
2020
"php-parallel-lint/php-parallel-lint": "~1.1.0",
2121
"phpunit/phpunit": "^8.5",
2222
"squizlabs/php_codesniffer": "~3.5.4"

src/MergePlugin.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Composer\Installer\PackageEvents;
2727
use Composer\IO\IOInterface;
2828
use Composer\Package\RootPackageInterface;
29+
use Composer\Plugin\PluginEvents;
2930
use Composer\Plugin\PluginInterface;
3031
use Composer\Script\Event as ScriptEvent;
3132
use Composer\Script\ScriptEvents;
@@ -87,11 +88,6 @@ class MergePlugin implements PluginInterface, EventSubscriberInterface
8788
*/
8889
const PACKAGE_NAME = 'wikimedia/composer-merge-plugin';
8990

90-
/**
91-
* Name of the composer 1.1 init event.
92-
*/
93-
const COMPAT_PLUGINEVENTS_INIT = 'init';
94-
9591
/**
9692
* Priority that plugin uses to register callbacks.
9793
*/
@@ -142,10 +138,7 @@ public function activate(Composer $composer, IOInterface $io)
142138
public static function getSubscribedEvents()
143139
{
144140
return array(
145-
// Use our own constant to make this event optional. Once
146-
// composer-1.1 is required, this can use PluginEvents::INIT
147-
// instead.
148-
self::COMPAT_PLUGINEVENTS_INIT =>
141+
PluginEvents::INIT =>
149142
array('onInit', self::CALLBACK_PRIORITY),
150143
InstallerEvents::PRE_DEPENDENCIES_SOLVING =>
151144
array('onDependencySolve', self::CALLBACK_PRIORITY),

tests/phpunit/MergePluginTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function testSubscribedEvents()
7979
InstallerEvents::PRE_DEPENDENCIES_SOLVING,
8080
$subscriptions
8181
);
82-
$this->assertArrayHasKey(MergePlugin::COMPAT_PLUGINEVENTS_INIT, $subscriptions);
82+
$this->assertArrayHasKey(PluginEvents::INIT, $subscriptions);
8383
$this->assertArrayHasKey(ScriptEvents::PRE_INSTALL_CMD, $subscriptions);
8484
$this->assertArrayHasKey(ScriptEvents::PRE_UPDATE_CMD, $subscriptions);
8585
$this->assertArrayHasKey(ScriptEvents::PRE_AUTOLOAD_DUMP, $subscriptions);
@@ -1407,7 +1407,7 @@ protected function triggerPlugin($package, $directory, $fireInit = false)
14071407

14081408
if ($fireInit) {
14091409
$init = new \Composer\EventDispatcher\Event(
1410-
MergePlugin::COMPAT_PLUGINEVENTS_INIT
1410+
PluginEvents::INIT
14111411
);
14121412
$this->fixture->onInit($init);
14131413
}

0 commit comments

Comments
 (0)