diff --git a/composer.json b/composer.json
index 3867ea73b..8d88cc832 100644
--- a/composer.json
+++ b/composer.json
@@ -1,73 +1,73 @@
{
- "name": "wp-cli/package-command",
- "type": "wp-cli-package",
- "description": "Lists, installs, and removes WP-CLI packages.",
- "homepage": "https://github.com/wp-cli/package-command",
- "license": "MIT",
- "authors": [
- {
- "name": "Daniel Bachhuber",
- "email": "daniel@runcommand.io",
- "homepage": "https://runcommand.io"
- }
- ],
- "require": {
- "ext-json": "*",
- "composer/composer": "^1.10.23 || ~2.2.17",
- "wp-cli/wp-cli": "^2.8"
- },
- "require-dev": {
- "wp-cli/scaffold-command": "^1 || ^2",
- "wp-cli/wp-cli-tests": "^4"
- },
- "config": {
- "process-timeout": 7200,
- "sort-packages": true,
- "allow-plugins": {
- "dealerdirect/phpcodesniffer-composer-installer": true,
- "johnpbloch/wordpress-core-installer": true
- }
- },
- "extra": {
- "branch-alias": {
- "dev-main": "2.x-dev"
- },
- "bundled": true,
- "commands": [
- "package",
- "package browse",
- "package install",
- "package list",
- "package update",
- "package uninstall"
- ]
- },
- "autoload": {
- "classmap": [
- "src/"
- ],
- "files": [
- "package-command.php"
- ]
- },
- "minimum-stability": "dev",
- "prefer-stable": true,
- "scripts": {
- "behat": "run-behat-tests",
- "behat-rerun": "rerun-behat-tests",
- "lint": "run-linter-tests",
- "phpcs": "run-phpcs-tests",
- "phpcbf": "run-phpcbf-cleanup",
- "phpunit": "run-php-unit-tests",
- "prepare-tests": "install-package-tests",
- "test": [
- "@lint",
- "@phpcs",
- "@phpunit",
- "@behat"
- ]
- },
- "support": {
- "issues": "https://github.com/wp-cli/package-command/issues"
+ "name": "wp-cli/package-command",
+ "type": "wp-cli-package",
+ "description": "Lists, installs, and removes WP-CLI packages.",
+ "homepage": "https://github.com/wp-cli/package-command",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Daniel Bachhuber",
+ "email": "daniel@runcommand.io",
+ "homepage": "https://runcommand.io"
+ }
+ ],
+ "require": {
+ "ext-json": "*",
+ "composer/composer": "^1.10.23 || ^2.2.17",
+ "wp-cli/wp-cli": "^2.8"
+ },
+ "require-dev": {
+ "wp-cli/scaffold-command": "^1 || ^2",
+ "wp-cli/wp-cli-tests": "^4"
+ },
+ "config": {
+ "process-timeout": 7200,
+ "sort-packages": true,
+ "allow-plugins": {
+ "dealerdirect/phpcodesniffer-composer-installer": true,
+ "johnpbloch/wordpress-core-installer": true
}
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-main": "2.x-dev"
+ },
+ "bundled": true,
+ "commands": [
+ "package",
+ "package browse",
+ "package install",
+ "package list",
+ "package update",
+ "package uninstall"
+ ]
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ],
+ "files": [
+ "package-command.php"
+ ]
+ },
+ "minimum-stability": "dev",
+ "prefer-stable": true,
+ "scripts": {
+ "behat": "run-behat-tests",
+ "behat-rerun": "rerun-behat-tests",
+ "lint": "run-linter-tests",
+ "phpcs": "run-phpcs-tests",
+ "phpcbf": "run-phpcbf-cleanup",
+ "phpunit": "run-php-unit-tests",
+ "prepare-tests": "install-package-tests",
+ "test": [
+ "@lint",
+ "@phpcs",
+ "@phpunit",
+ "@behat"
+ ]
+ },
+ "support": {
+ "issues": "https://github.com/wp-cli/package-command/issues"
+ }
}
diff --git a/features/package-install.feature b/features/package-install.feature
index 0e40d16f4..45a94a807 100644
--- a/features/package-install.feature
+++ b/features/package-install.feature
@@ -145,7 +145,7 @@ Feature: Install WP-CLI packages
When I run `wp package install git@github.com:wp-cli/google-sitemap-generator-cli.git`
Then STDOUT should contain:
"""
- Installing package wp-cli/google-sitemap-generator-cli (dev-master)
+ Installing package wp-cli/google-sitemap-generator-cli (dev-main)
"""
# This path is sometimes changed on Macs to prefix with /private
And STDOUT should contain:
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index e4f8965b1..e82b67bcc 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -16,6 +16,8 @@
*/src/WP_CLI/JsonManipulator\.php$
+ */src/WP_CLI/Package/Compat/Min_Composer_1_10/NullIOMethodsTrait\.php$
+ */src/WP_CLI/Package/Compat/Min_Composer_2_3/NullIOMethodsTrait\.php$
*/tests/test-json-manipulator\.php$
diff --git a/src/Package_Command.php b/src/Package_Command.php
index 9d9522936..e86d1d894 100644
--- a/src/Package_Command.php
+++ b/src/Package_Command.php
@@ -4,24 +4,18 @@
use Composer\Config;
use Composer\Config\JsonConfigSource;
use Composer\DependencyResolver\Pool;
-use Composer\DependencyResolver\Request;
-use Composer\EventDispatcher\Event;
use Composer\Factory;
use Composer\IO\NullIO;
use Composer\Installer;
use Composer\Json\JsonFile;
-use Composer\Package;
use Composer\Package\BasePackage;
use Composer\Package\PackageInterface;
-use Composer\Package\Version\VersionParser;
use Composer\Package\Version\VersionSelector;
use Composer\Repository;
use Composer\Repository\CompositeRepository;
use Composer\Repository\ComposerRepository;
-use Composer\Repository\RepositoryManager;
-use Composer\Util\Filesystem;
use Composer\Util\HttpDownloader;
-use WP_CLI\ComposerIO;
+use WP_CLI\Package\ComposerIO;
use WP_CLI\Extractor;
use WP_CLI\Utils;
use WP_CLI\JsonManipulator;
diff --git a/src/WP_CLI/Package/Compat/Min_Composer_1_10/NullIOMethodsTrait.php b/src/WP_CLI/Package/Compat/Min_Composer_1_10/NullIOMethodsTrait.php
new file mode 100644
index 000000000..2b59b4c72
--- /dev/null
+++ b/src/WP_CLI/Package/Compat/Min_Composer_1_10/NullIOMethodsTrait.php
@@ -0,0 +1,36 @@
+]+)>#', '$1$2', $messages );
+ foreach ( $messages as $message ) {
+ // phpcs:ignore WordPress.WP.AlternativeFunctions.strip_tags_strip_tags
+ WP_CLI::log( strip_tags( trim( $message ) ) );
+ }
+ }
+}
diff --git a/src/WP_CLI/Package/Compat/Min_Composer_2_3/NullIOMethodsTrait.php b/src/WP_CLI/Package/Compat/Min_Composer_2_3/NullIOMethodsTrait.php
new file mode 100644
index 000000000..27d21871f
--- /dev/null
+++ b/src/WP_CLI/Package/Compat/Min_Composer_2_3/NullIOMethodsTrait.php
@@ -0,0 +1,36 @@
+]+)>#', '$1$2', $messages );
+ foreach ( $messages as $message ) {
+ // phpcs:ignore WordPress.WP.AlternativeFunctions.strip_tags_strip_tags
+ WP_CLI::log( strip_tags( trim( $message ) ) );
+ }
+ }
+}
diff --git a/src/WP_CLI/Package/Compat/NullIOMethodsTrait.php b/src/WP_CLI/Package/Compat/NullIOMethodsTrait.php
new file mode 100644
index 000000000..cfe1a71c3
--- /dev/null
+++ b/src/WP_CLI/Package/Compat/NullIOMethodsTrait.php
@@ -0,0 +1,29 @@
+