Skip to content

Commit 9af1a2f

Browse files
authored
Merge branch 'main' into copilot/add-set-command-to-docs
2 parents 276115e + 1c594b8 commit 9af1a2f

File tree

5 files changed

+12
-19
lines changed

5 files changed

+12
-19
lines changed

bin/Handbook_Command.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -814,13 +814,10 @@ private static function parse_docblock( $docblock ) {
814814
if ( preg_match( '/^(?=\s+?\*[^\/])(.+)/', $line, $matches ) ) {
815815
$info = trim( $matches[1] );
816816
$info = preg_replace( '/^(\*\s+?)/', '', $info );
817-
if ( $in_param ) {
817+
if ( $in_param && ! empty( $info ) && '@' !== $info[0] ) {
818818
list( $param_name, $key ) = $in_param;
819819
$ret['parameters'][ $param_name ][ $key ][2] .= PHP_EOL . $info;
820-
if ( '}' === substr( $info, -1 ) ) {
821-
$in_param = false;
822-
}
823-
} elseif ( '@' !== $info[0] ) {
820+
} elseif ( ! empty( $info ) && '@' !== $info[0] ) {
824821
$ret['description'] .= PHP_EOL . "{$extra_line}{$info}";
825822
} else {
826823
preg_match( '/@(\w+)/', $info, $matches );
@@ -838,9 +835,11 @@ private static function parse_docblock( $docblock ) {
838835
end( $ret['parameters'][ $param_name ] );
839836
$key = key( $ret['parameters'][ $param_name ] );
840837
reset( $ret['parameters'][ $param_name ] );
841-
if ( ! empty( $ret['parameters'][ $param_name ][ $key ][2] )
842-
&& '{' === substr( $ret['parameters'][ $param_name ][ $key ][2], -1 ) ) {
838+
// Always set $in_param for tags that can have multiline descriptions
839+
if ( ! empty( $ret['parameters'][ $param_name ][ $key ][2] ) ) {
843840
$in_param = [ $param_name, $key ];
841+
} else {
842+
$in_param = false;
844843
}
845844
}
846845
$extra_line = '';

internal-api/wp-cli-debug.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Display debug message prefixed with "Debug: " when `--debug` is used.
1010

1111
<div>
1212
<strong>$message</strong> (string|WP_Error|Exception|Throwable) Message to write to STDERR.<br />
13-
<strong>$group</strong> (string|bool) Organize debug message to a specific group.<br />
13+
<strong>$group</strong> (string|bool) Organize debug message to a specific group.<br />Use `false` to not group the message.<br />
1414
<strong>@return</strong> (void) <br />
1515
</div>
1616

@@ -37,7 +37,6 @@ private static function set_wp_root( $path ) {
3737
# [...]
3838
# Debug: ABSPATH defined: /srv/www/wordpress-develop.dev/src/ (0.225s)
3939
```
40-
Use `false` to not group the message.
4140

4241

4342
*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.*

internal-api/wp-cli-do-hook.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Execute callbacks registered to a given hook.
1010

1111
<div>
1212
<strong>$when</strong> (string) Identifier for the hook.<br />
13-
<strong>...$args</strong> (mixed) Optional. Arguments that will be passed onto the<br />
14-
<strong>@return</strong> (null|mixed) the first optional argument if optional<br />
13+
<strong>...$args</strong> (mixed) Optional. Arguments that will be passed onto the<br /> callback provided by `WP_CLI::add_hook()`.<br />
14+
<strong>@return</strong> (null|mixed) the first optional argument if optional&lt;br /&gt; arguments were passed, otherwise returns null.<br />
1515
</div>
1616

1717

@@ -21,8 +21,6 @@ Execute callbacks registered to a given hook.
2121

2222
See `WP_CLI::add_hook()` for details on WP-CLI's internal hook system.
2323
Commands can provide and call their own hooks.
24-
callback provided by `WP_CLI::add_hook()`.
25-
arguments were passed, otherwise returns null.
2624

2725

2826
*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.*

internal-api/wp-cli-utils-esc-like.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ First half of escaping for LIKE special characters % and _ before preparing for
99
WP_CLI\Utils\esc_like( $text )
1010

1111
<div>
12-
<strong>$text</strong> (string) The raw text to be escaped. The input typed by the user should have no<br />
13-
<strong>@return</strong> (string) in the form of a LIKE phrase. The output is not SQL safe. Call $wpdb::prepare()<br />
12+
<strong>$text</strong> (string) The raw text to be escaped. The input typed by the user should have no<br /> extra or deleted slashes.<br />
13+
<strong>@return</strong> (string) in the form of a LIKE phrase. The output is not SQL safe. Call $wpdb::prepare()&lt;br /&gt; or real_escape next.<br />
1414
</div>
1515

1616

@@ -21,8 +21,6 @@ First half of escaping for LIKE special characters % and _ before preparing for
2121
Use this only before wpdb::prepare() or esc_sql(). Reversing the order is very bad for security.
2222

2323
Copied from core "wp-includes/wp-db.php". Avoids dependency on WP 4.4 wpdb.
24-
extra or deleted slashes.
25-
or real_escape next.
2624

2725

2826
*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.*

internal-api/wp-cli-utils-http-request.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Make a HTTP request to a remote URL.
1111
<div>
1212
<strong>$method</strong> (string) HTTP method (GET, POST, DELETE, etc.).<br />
1313
<strong>$url</strong> (string) URL to make the HTTP request to.<br />
14-
<strong>$data</strong> (array|null) Data to send either as a query string for GET/HEAD requests,<br />
14+
<strong>$data</strong> (array|null) Data to send either as a query string for GET/HEAD requests,<br /> or in the body for POST requests.<br />
1515
<strong>$headers</strong> (array) Add specific headers to the request.<br />
1616
<strong>$options</strong> (array) {<br /> Optional. An associative array of additional request options.<br /> @type bool $halt_on_error Whether or not command execution should be halted on error. Default: true<br /> @type bool|string $verify A boolean to use enable/disable SSL verification<br /> or string absolute path to CA cert to use.<br /> Defaults to detected CA cert bundled with the Requests library.<br /> @type bool $insecure Whether to retry automatically without certificate validation.<br />}<br />
1717
<strong>@return</strong> (\Requests_Response|Response) <br />
@@ -32,7 +32,6 @@ if ( 20 != substr( $md5_response->status_code, 0, 2 ) ) {
3232
WP_CLI::error( "Couldn't access md5 hash for release (HTTP code {$response->status_code})" );
3333
}
3434
```
35-
or in the body for POST requests.
3635

3736

3837
*Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.*

0 commit comments

Comments
 (0)