config-command icon indicating copy to clipboard operation
config-command copied to clipboard

Docs: Fix return_value() inline documentation

Open rollybueno opened this issue 2 months ago • 2 comments

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 avatar Oct 19 '25 07:10 rollybueno

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

swissspidy avatar Oct 19 '25 22:10 swissspidy

  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

rollybueno avatar Oct 26 '25 07:10 rollybueno