Skip to content

Docs: Fix return_value() inline documentation#205

Merged
swissspidy merged 5 commits intowp-cli:mainfrom
rollybueno:fix/doc-return_value
Feb 5, 2026
Merged

Docs: Fix return_value() inline documentation#205
swissspidy merged 5 commits intowp-cli:mainfrom
rollybueno:fix/doc-return_value

Conversation

@rollybueno
Copy link
Contributor

Corrected 2 inline docs for return_value():

  1. 3rd param is $values not a redundant $type.
  2. It's also an array since we loop the variable and looking for $value['name'] & $value['type'].
  3. @return is mixed since we are either return WP_CLI::error(), which technically null as per https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-error/, and $result[0]['value'] which is either boolean or string from WP config variables

@rollybueno rollybueno requested a review from a team as a code owner October 19, 2025 07:04
@swissspidy
Copy link
Member

3. @return is mixed since we are either return WP_CLI::error(), which technically null as per make.wordpress.org/cli/handbook/references/internal-api/wp-cli-error, and $result[0]['value'] which is either boolean or string from WP config variables

I don't think they can be booleans.. Can you double check that?

In any case, let's try to make the types as precise as possible. string|never is more accurate

@rollybueno
Copy link
Contributor Author

  1. @return is mixed since we are either return WP_CLI::error(), which technically null as per make.wordpress.org/cli/handbook/references/internal-api/wp-cli-error, and $result[0]['value'] which is either boolean or string from WP config variables

I don't think they can be booleans.. Can you double check that?

In any case, let's try to make the types as precise as possible. string|never is more accurate

The WP_CLI:error() here uses exit() so it indeed never, but it's returning mixed as well and not just string. So it should be mixed|never

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR corrects inline documentation for the return_value() method in the Config_Command class. The changes fix a duplicate parameter name and update the type annotations.

Changes:

  • Fixed duplicate @param entry for $type - replaced with correct $values parameter
  • Updated @param type annotation for $values to reflect its array structure
  • Updated @return annotation to describe the return type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy added this to the 2.5.0 milestone Feb 5, 2026
@swissspidy swissspidy merged commit baa40da into wp-cli:main Feb 5, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants