-
Notifications
You must be signed in to change notification settings - Fork 18
Description
I understand that the bug has presented itself with the package commands (which are in a different repository), but the issue stems from the ComposerIO.php file in this repository.
Bug Report
- Yes, I reviewed the contribution guidelines.
- Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
Attempting to install a wp-cli package from the instructions listed here. Doing so results in the error:
PHP Fatal error: Declaration of WP_CLI\ComposerIO::isVerbose() must be compatible with Composer\IO\NullIO::isVerbose(): bool in /app/vendor/wp-cli/wp-cli/php/WP_CLI/ComposerIO.php on line 16Wp-cli package I'm attempting to install: https://github.com/gilzow/wp-graphql-jwt-authentication-wp-cli
Package was built according to the directions in the Commands Cookbook. Including the package in a plugin works as expected.
Output when trying to install:
$ wp package install https://github.com/gilzow/wp-graphql-jwt-authentication-wp-cli.git
Installing package gilzow/wp-graphql-jwt-authentication-wp-cli (dev-main)
Updating /var/www/.wp-cli/packages/composer.json to require the package...
Registering https://github.com/gilzow/wp-graphql-jwt-authentication-wp-cli.git as a VCS repository...
PHP Fatal error: Declaration of WP_CLI\ComposerIO::isVerbose() must be compatible with Composer\IO\NullIO::isVerbose(): bool in /app/vendor/wp-cli/wp-cli/php/WP_CLI/ComposerIO.php on line 16
Fatal error: Declaration of WP_CLI\ComposerIO::isVerbose() must be compatible with Composer\IO\NullIO::isVerbose(): bool in /app/vendor/wp-cli/wp-cli/php/WP_CLI/ComposerIO.php on line 16
Reverted composer.json.I also attempted to install the package as a zip file, and as a local directory. Error message remains the same.
Describe how other contributors can replicate this bug
see above.
Describe what you would expect as the correct outcome
Package should install or error indicating the root issue with installation.
Let us know what environment you are running this on
$ wp cli info
OS: Linux 5.10.47-linuxkit wp-cli/wp-cli#1 SMP Sat Jul 3 21:51:47 UTC 2021 x86_64
Shell: /bin/dash
PHP binary: /usr/bin/php
PHP version: 7.4.23
php.ini used: /etc/php/7.4-zts/cli/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 15.1 Distrib 10.1.48-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
SQL modes:
WP-CLI root dir: /app/.platform/local/deps/php/vendor/wp-cli/wp-cli
WP-CLI vendor dir: /app/.platform/local/deps/php/vendor
WP_CLI phar path:
WP-CLI packages dir: /var/www/.wp-cli/packages/
WP-CLI global config:
WP-CLI project config: /app/wp-cli.yml
WP-CLI version: 2.6.0Provide a possible solution
After updating /vendor/wp-cli/wp-cli/php/WP_CLI/ComposerIO.php to match the signature from /vendor/composer/composer/src/Composer/IO/NullIO.php and tried installing again, it then errored:
PHP Fatal error: Declaration of WP_CLI\ComposerIO::write($messages, $newline = true, $verbosity = self::NORMAL) must be compatible with Composer\IO\NullIO::write($messages, bool $newline = true, int $verbosity = self::NORMAL): void in /vendor/wp-cli/wp-cli/php/WP_CLI/ComposerIO.php on line 23After updating that signature to match, it then complained about the signature for WP_CLI\ComposerIO::writeError. After updating that signature and trying again, THEN it successfully installed the above package.