wp-cli / handbook

📖 Complete documentation for WP-CLI
https://make.wordpress.org/cli/handbook/
MIT License
186 stars 320 forks source link

Fix: Undefined array key warning / Require wp-cli 2.11 #525

Closed BrianHenryIE closed 2 weeks ago

BrianHenryIE commented 2 weeks ago
PHP Warning:  Undefined array key "hook" in /.../wp-cli/handbook/bin/command.php on line 438

The $cmd['hook'] value

https://github.com/wp-cli/handbook/blob/bebc75bc7fa0a1c65ee07bb8904ad9f7a6930bb1/bin/command.php#L426

which stems from

https://github.com/wp-cli/handbook/blob/bebc75bc7fa0a1c65ee07bb8904ad9f7a6930bb1/bin/command.php#L168

which uses CLI_Command::command_to_array()

was added in the (yet to be released) v2.11 (vs v2.10) – wp-cli/wp-cli@6d78633.

This PR adds "wp-cli/wp-cli": "^2.11" to composer.json so the correct minimum version is used.

ernilambar commented 2 weeks ago

Did you follow these steps?

wp cli update --nightly
bin/install_packages.sh
WP_CLI_PACKAGES_DIR=bin/packages WP_CLI_CONFIG_PATH=/dev/null wp handbook gen-all

Generally handbook commands docs are generated with nightly version.

swissspidy commented 2 weeks ago

Makes sense to have that explicitly reflected in the composer dependencies 👍