From 3d796edc68005fde887a90a45cd81e0af074e5a8 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 18 Aug 2023 17:46:18 +0000 Subject: [PATCH] REST API: Correct the docblocks for various permission related methods. See #58833 Built from https://develop.svn.wordpress.org/trunk@56415 git-svn-id: http://core.svn.wordpress.org/trunk@55927 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../endpoints/class-wp-rest-menu-items-controller.php | 4 ++-- .../endpoints/class-wp-rest-menu-locations-controller.php | 2 +- .../rest-api/endpoints/class-wp-rest-menus-controller.php | 4 ++-- .../rest-api/endpoints/class-wp-rest-posts-controller.php | 4 ++-- .../rest-api/endpoints/class-wp-rest-terms-controller.php | 4 ++-- .../rest-api/endpoints/class-wp-rest-themes-controller.php | 4 ++-- wp-includes/version.php | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php index 940e0702df..4119b6530e 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php @@ -57,7 +57,7 @@ class WP_REST_Menu_Items_Controller extends WP_REST_Posts_Controller { * @since 5.9.0 * * @param WP_REST_Request $request Full details about the request. - * @return bool|WP_Error True if the request has read access for the item, WP_Error object otherwise. + * @return bool|WP_Error True if the request has read access for the item, WP_Error object or false otherwise. */ public function get_item_permissions_check( $request ) { $permission_check = parent::get_item_permissions_check( $request ); @@ -77,7 +77,7 @@ class WP_REST_Menu_Items_Controller extends WP_REST_Posts_Controller { * @since 5.9.0 * * @param WP_REST_Request $request Full details about the request. - * @return bool|WP_Error Whether the current user has permission. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. */ protected function check_has_read_only_access( $request ) { if ( current_user_can( 'edit_theme_options' ) ) { diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php index 5c06dc7a65..5d25b47f5f 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php @@ -120,7 +120,7 @@ class WP_REST_Menu_Locations_Controller extends WP_REST_Controller { * @since 5.9.0 * * @param WP_REST_Request $request Full details about the request. - * @return WP_Error|bool True if the request has read access for the item, WP_Error object otherwise. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. */ public function get_item_permissions_check( $request ) { if ( ! current_user_can( 'edit_theme_options' ) ) { diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php index 719377db8f..3b8205f89d 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php @@ -40,7 +40,7 @@ class WP_REST_Menus_Controller extends WP_REST_Terms_Controller { * @since 5.9.0 * * @param WP_REST_Request $request Full details about the request. - * @return bool|WP_Error True if the request has read access for the item, otherwise false or WP_Error object. + * @return true|WP_Error True if the request has read access for the item, otherwise WP_Error object. */ public function get_item_permissions_check( $request ) { $has_permission = parent::get_item_permissions_check( $request ); @@ -81,7 +81,7 @@ class WP_REST_Menus_Controller extends WP_REST_Terms_Controller { * @since 5.9.0 * * @param WP_REST_Request $request Full details about the request. - * @return bool|WP_Error Whether the current user has permission. + * @return true|WP_Error True if the current user has permission, WP_Error object otherwise. */ protected function check_has_read_only_access( $request ) { if ( current_user_can( 'edit_theme_options' ) ) { diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index 4ec972347f..356c321129 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php @@ -475,7 +475,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { * @since 4.7.0 * * @param WP_REST_Request $request Full details about the request. - * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + * @return bool|WP_Error True if the request has read access for the item, WP_Error object or false otherwise. */ public function get_item_permissions_check( $request ) { $post = $this->get_post( $request['id'] ); @@ -1506,7 +1506,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { * * @param string $template Page template filename. * @param WP_REST_Request $request Request. - * @return bool|WP_Error True if template is still valid or if the same as existing value, or false if template not supported. + * @return true|WP_Error True if template is still valid or if the same as existing value, or a WP_Error if template not supported. */ public function check_template( $template, $request ) { diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php index 4fda654746..cf9dc917c4 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php @@ -179,7 +179,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { * @since 4.7.0 * * @param WP_REST_Request $request Full details about the request. - * @return true|WP_Error True if the request has read access, otherwise false or WP_Error object. + * @return bool|WP_Error True if the request has read access, otherwise false or WP_Error object. */ public function get_items_permissions_check( $request ) { $tax_obj = get_taxonomy( $this->taxonomy ); @@ -417,7 +417,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { * @since 4.7.0 * * @param WP_REST_Request $request Full details about the request. - * @return true|WP_Error True if the request has read access for the item, otherwise false or WP_Error object. + * @return true|WP_Error True if the request has read access for the item, otherwise WP_Error object. */ public function get_item_permissions_check( $request ) { $term = $this->get_term( $request['id'] ); diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php index 075be9efe4..ac326e98c7 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php @@ -118,7 +118,7 @@ class WP_REST_Themes_Controller extends WP_REST_Controller { * @since 5.7.0 * * @param WP_REST_Request $request Full details about the request. - * @return bool|WP_Error True if the request has read access for the item, otherwise WP_Error object. + * @return true|WP_Error True if the request has read access for the item, otherwise WP_Error object. */ public function get_item_permissions_check( $request ) { if ( current_user_can( 'switch_themes' ) || current_user_can( 'manage_network_themes' ) ) { @@ -144,7 +144,7 @@ class WP_REST_Themes_Controller extends WP_REST_Controller { * * @since 5.7.0 * - * @return bool|WP_Error Whether the theme can be read. + * @return true|WP_Error True if the theme can be read, WP_Error object otherwise. */ protected function check_read_active_theme_permission() { if ( current_user_can( 'edit_posts' ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 6f50f6067f..00657de69b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-alpha-56414'; +$wp_version = '6.4-alpha-56415'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.