Skip to content

Commit 2d55126

Browse files
t-hamanoclaude
andcommitted
Update PHPDoc for Connectors preloading and rest_preload_api_request()
Bump @SInCE to 7.2.0, fix the JS source reference comment to match the Gutenberg PR, and document the allowed statuses element of the $path array. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 030f827 commit 2d55126

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎src/wp-admin/options-connectors.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939
* plugin capability discovery, and each connector's plugin record after
4040
* the JS hydrates, which noticeably delays first paint.
4141
*
42-
* @since 7.0.1
42+
* @since 7.2.0
4343
* @access private
4444
*
4545
* @param array<string|array{ 0: string, 1?: 'GET'|'OPTIONS', 2?: int<100, 599>|int<100, 599>[] }> $preload_paths Paths already queued for preloading.
4646
* @return array<string|array{ 0: string, 1?: 'GET'|'OPTIONS', 2?: int<100, 599>|int<100, 599>[] }> Paths with the Connectors-specific requests appended.
4747
*/
4848
function _wp_connectors_preload_paths( array $preload_paths ): array {
49-
// getEntityRecord( 'root', 'site' ) in stage.tsx / use-connector-plugin.ts.
49+
// getEntityRecord( 'root', 'site' ) in use-connector-plugin.ts / ai-plugin-callout.tsx.
5050
$preload_paths[] = '/wp/v2/settings';
5151

5252
// canUser( 'create', { kind: 'root', name: 'plugin' } ) in stage.tsx.

‎src/wp-includes/rest-api.php‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2981,9 +2981,13 @@ function rest_sanitize_value_from_schema( $value, $args, $param = '' ) {
29812981
* Expected to be called in the context of `array_reduce`.
29822982
*
29832983
* @since 5.0.0
2984+
* @since 7.2.0 The `$path` array may include a third element for the allowed response statuses.
29842985
*
29852986
* @param array $memo Reduce accumulator.
2986-
* @param string|array $path REST API path to preload.
2987+
* @param string|array $path REST API path to preload, or an array containing the path,
2988+
* the HTTP method ('GET' or 'OPTIONS'), and the allowed response
2989+
* status code(s). Only responses with an allowed status are
2990+
* preloaded. Default allowed status is 200.
29872991
* @return array Modified reduce accumulator.
29882992
*
29892993
* @phpstan-param array<string, array{ body: array<mixed>, headers: array<string, string> } | array<string, array{ body: array<mixed>, headers: array<string, string> }> > $memo

0 commit comments

Comments
 (0)