Fix regression that broke extending existing commands by schlessera · Pull Request #5563 · wp-cli/wp-cli

Conversation

@schlessera

There was a regression in the code that handles command namespaces that made it impossible to extend an existing command class.

This PR reverts the regression and adds a test scenario to ensure this type of extension will not be regressing again.

Fixes #5274

sun

sun approved these changes Sep 30, 2021

@sun sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a simple fix accompanied with tests, which are passing. 👍

Wondering whether we should restore the final condition testing for other possible values of existing commands that were removed in the previous commit that introduced the test for false in #5203?

} elseif ( false !== $existing_command ) {
// Command already registered, so abort to avoid double registration.
return false;
}

@schlessera

Wondering whether we should restore the final condition testing for other possible values of existing commands that were removed in the previous commit that introduced the test for false in #5203?

I think that would make it impossible again to override bundled commands, as the new command would just be skipped.

@schlessera schlessera deleted the fix/5274-allow-extending-bundled-commands branch

November 11, 2021 15:25

This was referenced

Jan 6, 2022

@Dan-Q Dan-Q mentioned this pull request

Jun 8, 2023

Labels

2 participants

@schlessera @sun