From 9bb4369bc1658d4047fe087fe9d158d72cf456c6 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 18 Aug 2023 17:44:29 +0000 Subject: [PATCH] REST API: Correct the docblocks for various permission related methods. See #58833 git-svn-id: https://develop.svn.wordpress.org/trunk@56415 602fd350-edb4-49c9-b593-d223f7449a82 --- .../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 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php index 940e0702df..4119b6530e 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php +++ b/src/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/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php index 5c06dc7a65..5d25b47f5f 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php +++ b/src/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/src/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php index 719377db8f..3b8205f89d 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php +++ b/src/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/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index 4ec972347f..356c321129 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/src/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/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php index 4fda654746..cf9dc917c4 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php +++ b/src/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/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php index 075be9efe4..ac326e98c7 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php +++ b/src/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' ) ) {