Skip to content

Commit

Permalink
Docs: Correct @return values for a few REST API class methods.
Browse files Browse the repository at this point in the history
Includes listing the expected type first, instead of `WP_Error`.

Follow-up to [39031], [39033], [46696], [49927], [49929], [50993], [51286], [51973], [52079], [52286], [53152], [56415].

Props antonvlasenko.
See #61593.

git-svn-id: https://develop.svn.wordpress.org/trunk@58704 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Jul 10, 2024
1 parent e41df7c commit 9cff1de
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function get_items_permissions_check( $request ) {
* @since 6.0.0
*
* @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 ) {
$response = array();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function register_routes() {
*
* @since 5.9.0
*
* @return WP_Error|true True if the request has access, or WP_Error object.
* @return true|WP_Error True if the request has access, or WP_Error object.
*/
public function permissions_check() {
if ( current_user_can( 'edit_theme_options' ) ) {
Expand All @@ -70,7 +70,7 @@ public function permissions_check() {
*
* @since 5.9.0
*
* @return WP_Error|void
* @return void|WP_Error
*/
public function export() {
// Generate the export file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function register_routes() {
* @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, 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 ) {
if ( ! current_user_can( 'edit_theme_options' ) ) {
Expand All @@ -97,7 +97,7 @@ public function get_items_permissions_check( $request ) {
* @since 5.9.0
*
* @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 ) {
$data = array();
Expand Down Expand Up @@ -140,7 +140,7 @@ public function get_item_permissions_check( $request ) {
* @since 5.9.0
*
* @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 ) {
$registered_menus = get_registered_nav_menus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function get_items( $request ) {
* @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 bool|WP_Error True if the request has read access for the item, otherwise false or WP_Error object.
*/
public function get_item_permissions_check( $request ) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ public function get_item( $request ) {
* @since 4.7.0
*
* @param WP_REST_Request $request Full details about the request.
* @return true|WP_Error True if the request has access to create items, false or WP_Error object otherwise.
* @return bool|WP_Error True if the request has access to create items, otherwise false or WP_Error object.
*/
public function create_item_permissions_check( $request ) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function parse_url_details( $request ) {
*
* @since 5.9.0
*
* @return WP_Error|bool True if the request has permission, else WP_Error.
* @return true|WP_Error True if the request has permission, else WP_Error.
*/
public function permissions_check() {
if ( current_user_can( 'edit_posts' ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function get_items_permissions_check( $request ) {
* @since 5.8.0
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
* @return WP_REST_Response Response object.
*/
public function get_items( $request ) {
$this->retrieve_widgets();
Expand Down

0 comments on commit 9cff1de

Please sign in to comment.