Docs: List the expected type first instead of `WP_Error` in some REST API methods added in 5.8.

Follow-up to [46696], [49929], [50995], [51021].

See #52628, #53461.
Built from https://develop.svn.wordpress.org/trunk@51286


git-svn-id: http://core.svn.wordpress.org/trunk@50895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-06-30 17:59:58 +00:00
parent e7b6a4dce8
commit 8f4593b124
3 changed files with 8 additions and 8 deletions

View File

@ -57,7 +57,7 @@ class WP_REST_Pattern_Directory_Controller extends WP_REST_Controller {
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* *
* @return WP_Error|bool True if the request has permission, WP_Error object otherwise. * @return true|WP_Error True if the request has permission, WP_Error object otherwise.
*/ */
public function get_items_permissions_check( $request ) { public function get_items_permissions_check( $request ) {
if ( current_user_can( 'edit_posts' ) ) { if ( current_user_can( 'edit_posts' ) ) {
@ -84,7 +84,7 @@ class WP_REST_Pattern_Directory_Controller extends WP_REST_Controller {
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* *
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/ */
public function get_items( $request ) { public function get_items( $request ) {
/* /*

View File

@ -107,7 +107,7 @@ class WP_REST_Widget_Types_Controller extends WP_REST_Controller {
* @since 5.8.0 * @since 5.8.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|bool True if the request has read access, WP_Error object otherwise. * @return true|WP_Error True if the request has read access, WP_Error object otherwise.
*/ */
public function get_items_permissions_check( $request ) { public function get_items_permissions_check( $request ) {
return $this->check_read_permission(); return $this->check_read_permission();
@ -119,7 +119,7 @@ class WP_REST_Widget_Types_Controller extends WP_REST_Controller {
* @since 5.8.0 * @since 5.8.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/ */
public function get_items( $request ) { public function get_items( $request ) {
$data = array(); $data = array();
@ -137,7 +137,7 @@ class WP_REST_Widget_Types_Controller extends WP_REST_Controller {
* @since 5.8.0 * @since 5.8.0
* *
* @param WP_REST_Request $request Full details about the request. * @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 ) { public function get_item_permissions_check( $request ) {
$check = $this->check_read_permission(); $check = $this->check_read_permission();
@ -158,7 +158,7 @@ class WP_REST_Widget_Types_Controller extends WP_REST_Controller {
* *
* @since 5.8.0 * @since 5.8.0
* *
* @return WP_Error|bool True if the widget type is visible, WP_Error otherwise. * @return true|WP_Error True if the widget type is visible, WP_Error otherwise.
*/ */
protected function check_read_permission() { protected function check_read_permission() {
if ( ! current_user_can( 'edit_theme_options' ) ) { if ( ! current_user_can( 'edit_theme_options' ) ) {
@ -246,7 +246,7 @@ class WP_REST_Widget_Types_Controller extends WP_REST_Controller {
* @since 5.8.0 * @since 5.8.0
* *
* @param WP_REST_Request $request Full details about the request. * @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/ */
public function get_item( $request ) { public function get_item( $request ) {
$widget_id = $request['id']; $widget_id = $request['id'];

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.9-alpha-51285'; $wp_version = '5.9-alpha-51286';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.