From 077504e755993f4385e583fb71f387e8829c1ecc Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 1 Jul 2021 22:01:44 +0000 Subject: [PATCH] Docs: Further type corrections and improvements for various docblocks. See #53399 git-svn-id: https://develop.svn.wordpress.org/trunk@51302 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/image-edit.php | 10 +++++----- src/wp-admin/includes/media.php | 2 +- src/wp-admin/includes/post.php | 17 ++++++++++++++--- src/wp-admin/includes/taxonomy.php | 6 ++++-- .../class-wp-rest-search-controller.php | 2 +- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/wp-admin/includes/image-edit.php b/src/wp-admin/includes/image-edit.php index 95da5af3d5..1debdeaaaa 100644 --- a/src/wp-admin/includes/image-edit.php +++ b/src/wp-admin/includes/image-edit.php @@ -373,11 +373,11 @@ function wp_save_image_file( $filename, $image, $mime_type, $post_id ) { * @since 2.9.0 * @deprecated 3.5.0 Use {@see 'wp_save_image_editor_file'} instead. * - * @param mixed $override Value to return instead of saving. Default null. - * @param string $filename Name of the file to be saved. - * @param WP_Image_Editor $image The image editor instance. - * @param string $mime_type The mime type of the image. - * @param int $post_id Attachment post ID. + * @param bool|null $override Value to return instead of saving. Default null. + * @param string $filename Name of the file to be saved. + * @param resource|GdImage $image The image editor instance. + * @param string $mime_type The mime type of the image. + * @param int $post_id Attachment post ID. */ $saved = apply_filters_deprecated( 'wp_save_image_file', diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php index 97d59942ad..269a9ba333 100644 --- a/src/wp-admin/includes/media.php +++ b/src/wp-admin/includes/media.php @@ -715,7 +715,7 @@ function get_upload_iframe_src( $type = null, $post_id = null, $tab = null ) { * * @since 2.5.0 * - * @return mixed void|object WP_Error on failure + * @return null|array|void Array of error messages keyed by attachment ID, null or void on success. */ function media_upload_form_handler() { check_admin_referer( 'media-form' ); diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php index 9b66f92d21..718e18d1d5 100644 --- a/src/wp-admin/includes/post.php +++ b/src/wp-admin/includes/post.php @@ -978,7 +978,7 @@ function delete_meta( $mid ) { * * @global wpdb $wpdb WordPress database abstraction object. * - * @return mixed + * @return string[] Array of meta key names. */ function get_meta_keys() { global $wpdb; @@ -1013,8 +1013,19 @@ function get_post_meta_by_id( $mid ) { * * @global wpdb $wpdb WordPress database abstraction object. * - * @param int $postid - * @return mixed + * @param int $postid A post ID. + * @return array { + * Array of meta data arrays for the given post ID. + * + * @type array ...$0 { + * Associative array of meta data. + * + * @type string $meta_key Meta key. + * @type mixed $meta_value Meta value. + * @type string $meta_id Meta ID as a numeric string. + * @type string $post_id Post ID as a numeric string. + * } + * } */ function has_meta( $postid ) { global $wpdb; diff --git a/src/wp-admin/includes/taxonomy.php b/src/wp-admin/includes/taxonomy.php index 0e0688012a..b52533d30c 100644 --- a/src/wp-admin/includes/taxonomy.php +++ b/src/wp-admin/includes/taxonomy.php @@ -19,7 +19,7 @@ * * @param int|string $cat_name Category name. * @param int $parent Optional. ID of parent term. - * @return mixed + * @return string|null Returns the category ID as a numeric string if the pairing exists, null if not. */ function category_exists( $cat_name, $parent = null ) { $id = term_exists( $cat_name, 'category', $parent ); @@ -215,7 +215,9 @@ function wp_update_category( $catarr ) { * @since 2.3.0 * * @param int|string $tag_name - * @return mixed + * @return mixed Returns null if the term does not exist. + * Returns an array of the term ID and the term taxonomy ID if the pairing exists. + * Returns 0 if term ID 0 is passed to the function. */ function tag_exists( $tag_name ) { return term_exists( $tag_name, 'post_tag' ); diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php index 0e223ffb77..a0f2e17520 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php @@ -50,7 +50,7 @@ class WP_REST_Search_Controller extends WP_REST_Controller { * Search handlers used by the controller. * * @since 5.0.0 - * @var array + * @var WP_REST_Search_Handler[] */ protected $search_handlers = array();