From 056dad9c2c1e642a353529cc3aa14b1335881162 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 1 Mar 2020 10:38:07 +0000 Subject: [PATCH] Docs: Use more specific types in parameter descriptions in place of `mixed`. See #48303. Built from https://develop.svn.wordpress.org/trunk@47397 git-svn-id: http://core.svn.wordpress.org/trunk@47184 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/image-edit.php | 2 +- wp-admin/includes/post.php | 8 +++++--- wp-admin/link-parse-opml.php | 4 ++-- wp-includes/blocks.php | 12 ++++++------ wp-includes/class-wp-query.php | 12 ++++++------ wp-includes/class-wp-theme.php | 8 +++++--- wp-includes/comment.php | 2 +- wp-includes/feed.php | 11 +++++------ wp-includes/functions.php | 2 +- wp-includes/general-template.php | 8 ++++---- wp-includes/pluggable.php | 10 +++++----- wp-includes/query.php | 10 +++++----- .../endpoints/class-wp-rest-autosaves-controller.php | 2 +- .../endpoints/class-wp-rest-users-controller.php | 4 ++-- wp-includes/version.php | 2 +- 15 files changed, 50 insertions(+), 47 deletions(-) diff --git a/wp-admin/includes/image-edit.php b/wp-admin/includes/image-edit.php index 63e7e7b8ad..b48be674f3 100644 --- a/wp-admin/includes/image-edit.php +++ b/wp-admin/includes/image-edit.php @@ -337,7 +337,7 @@ function wp_save_image_file( $filename, $image, $mime_type, $post_id ) { * * @since 3.5.0 * - * @param mixed $override Value to return instead of saving. Default null. + * @param bool|null $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. diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index ad01e545b3..f2900338d8 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -2019,8 +2019,9 @@ function redirect_post( $post_id = '' ) { * * @since 5.1.0 * - * @param mixed $terms Raw term data from the 'tax_input' field. - * @return array + * @param string $taxonomy The taxonomy name. + * @param array $terms Raw term data from the 'tax_input' field. + * @return int[] Array of sanitized term IDs. */ function taxonomy_meta_box_sanitize_cb_checkboxes( $taxonomy, $terms ) { return array_map( 'intval', $terms ); @@ -2031,7 +2032,8 @@ function taxonomy_meta_box_sanitize_cb_checkboxes( $taxonomy, $terms ) { * * @since 5.1.0 * - * @param mixed $terms Raw term data from the 'tax_input' field. + * @param string $taxonomy The taxonomy name. + * @param array|string $terms Raw term data from the 'tax_input' field. * @return array */ function taxonomy_meta_box_sanitize_cb_input( $taxonomy, $terms ) { diff --git a/wp-admin/link-parse-opml.php b/wp-admin/link-parse-opml.php index b26df319f1..ad53d07d24 100644 --- a/wp-admin/link-parse-opml.php +++ b/wp-admin/link-parse-opml.php @@ -27,7 +27,7 @@ global $opml; * @global array $descriptions * @global array $feeds * - * @param mixed $parser XML Parser resource. + * @param resource $parser XML Parser resource. * @param string $tagName XML element name. * @param array $attrs XML element attributes. */ @@ -65,7 +65,7 @@ function startElement( $parser, $tagName, $attrs ) { // phpcs:ignore WordPress.N * @since 0.71 * @access private * - * @param mixed $parser XML Parser resource. + * @param resource $parser XML Parser resource. * @param string $tagName XML tag name. */ function endElement( $parser, $tagName ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index a07e51f959..422b75e945 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -311,12 +311,12 @@ function filter_block_kses( $block, $allowed_html, $allowed_protocols = array() * * @since 5.3.1 * - * @param mixed $value The attribute value to filter. - * @param array[]|string $allowed_html An array of allowed HTML elements - * and attributes, or a context name - * such as 'post'. - * @param string[] $allowed_protocols Array of allowed URL protocols. - * @return array The filtered and sanitized result. + * @param string[]|string $value The attribute value to filter. + * @param array[]|string $allowed_html An array of allowed HTML elements + * and attributes, or a context name + * such as 'post'. + * @param string[] $allowed_protocols Array of allowed URL protocols. + * @return string[]|string The filtered and sanitized result. */ function filter_block_kses_value( $value, $allowed_html, $allowed_protocols = array() ) { if ( is_array( $value ) ) { diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php index 6d6c294478..f503407a8a 100644 --- a/wp-includes/class-wp-query.php +++ b/wp-includes/class-wp-query.php @@ -3630,7 +3630,7 @@ class WP_Query { * * @since 3.1.0 * - * @param mixed $attachment Attachment ID, title, slug, or array of such. + * @param int|string|int[]|string[] $attachment Optional. Attachment ID, title, slug, or array of such to check against. * @return bool */ public function is_attachment( $attachment = '' ) { @@ -3664,7 +3664,7 @@ class WP_Query { * * @since 3.1.0 * - * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames + * @param int|string|int[]|string[] $author Optional. User ID, nickname, nicename, or array of such to check against. * @return bool */ public function is_author( $author = '' ) { @@ -3699,7 +3699,7 @@ class WP_Query { * * @since 3.1.0 * - * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs. + * @param int|string|int[]|string[] $category Optional. Category ID, name, slug, or array of such to check against. * @return bool */ public function is_category( $category = '' ) { @@ -3734,7 +3734,7 @@ class WP_Query { * * @since 3.1.0 * - * @param mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs. + * @param int|string|int[]|string[] $tag Optional. Tag ID, name, slug, or array of such to check against. * @return bool */ public function is_tag( $tag = '' ) { @@ -3775,8 +3775,8 @@ class WP_Query { * * @global array $wp_taxonomies * - * @param mixed $taxonomy Optional. Taxonomy slug or slugs. - * @param mixed $term Optional. Term ID, name, slug or array of Term IDs, names, and slugs. + * @param string|string[] $taxonomy Optional. Taxonomy slug or slugs to check against. + * @param int|string|int[]|string[] $term Optional. Term ID, name, slug, or array of such to check against. * @return bool True for custom taxonomy archive pages, false for built-in taxonomies (category and tag archives). */ public function is_tax( $taxonomy = '', $term = '' ) { diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index 9a6c932322..d74ce04525 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -1164,9 +1164,11 @@ final class WP_Theme implements ArrayAccess { * * @since 3.4.0 * - * @param mixed $type Optional. Array of extensions to return. Defaults to all files (null). - * @param int $depth Optional. How deep to search for files. Defaults to a flat scan (0 depth). -1 depth is infinite. - * @param bool $search_parent Optional. Whether to return parent files. Defaults to false. + * @param string[]|string $type Optional. Array of extensions to find, string of a single extension, + * or null for all extensions. Default null. + * @param int $depth Optional. How deep to search for files. Defaults to a flat scan (0 depth). + * -1 depth is infinite. + * @param bool $search_parent Optional. Whether to return parent files. Default false. * @return string[] Array of files, keyed by the path to the file relative to the theme's directory, with the values * being absolute paths. */ diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 95fbd5860e..15cb44bcc3 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -213,7 +213,7 @@ function get_comment( &$comment = null, $output = OBJECT ) { * * @since 2.3.0 * - * @param mixed $_comment Comment data. + * @param WP_Comment $_comment Comment data. */ $_comment = apply_filters( 'get_comment', $_comment ); diff --git a/wp-includes/feed.php b/wp-includes/feed.php index bdc7ce3f4c..49c262d1ed 100644 --- a/wp-includes/feed.php +++ b/wp-includes/feed.php @@ -743,10 +743,9 @@ function feed_content_type( $type = '' ) { * * @since 2.8.0 * - * @param mixed $url URL of feed to retrieve. If an array of URLs, the feeds are merged - * using SimplePie's multifeed feature. - * See also {@link http://simplepie.org/wiki/faq/typical_multifeed_gotchas} - * + * @param string|string[] $url URL of feed to retrieve. If an array of URLs, the feeds are merged + * using SimplePie's multifeed feature. + * See also {@link http://simplepie.org/wiki/faq/typical_multifeed_gotchas} * @return SimplePie|WP_Error SimplePie object on success or WP_Error object on failure. */ function fetch_feed( $url ) { @@ -777,8 +776,8 @@ function fetch_feed( $url ) { * * @since 3.0.0 * - * @param SimplePie $feed SimplePie feed object (passed by reference). - * @param mixed $url URL of feed to retrieve. If an array of URLs, the feeds are merged. + * @param SimplePie $feed SimplePie feed object (passed by reference). + * @param string|string[] $url URL of feed or array of URLs of feeds to retrieve. */ do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) ); $feed->init(); diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 10e8ad49fe..099d598f59 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2645,7 +2645,7 @@ function wp_upload_bits( $name, $deprecated, $bits, $time = null ) { * * @since 3.0.0 * - * @param mixed $upload_bits_error An array of upload bits data, or a non-array error to return. + * @param array|string $upload_bits_error An array of upload bits data, or error message to return. */ $upload_bits_error = apply_filters( 'wp_upload_bits', diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 281e85307e..07c7520ed1 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -823,8 +823,8 @@ function get_bloginfo( $show = '', $filter = 'raw' ) { * * @since 2.0.5 * - * @param mixed $output The URL returned by bloginfo(). - * @param mixed $show Type of information requested. + * @param string $output The URL returned by bloginfo(). + * @param string $show Type of information requested. */ $output = apply_filters( 'bloginfo_url', $output, $show ); } else { @@ -833,8 +833,8 @@ function get_bloginfo( $show = '', $filter = 'raw' ) { * * @since 0.71 * - * @param mixed $output The requested non-URL site information. - * @param mixed $show Type of information requested. + * @param mixed $output The requested non-URL site information. + * @param string $show Type of information requested. */ $output = apply_filters( 'bloginfo', $output, $show ); } diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index d8ed6fa53f..efecaacb10 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -821,11 +821,11 @@ if ( ! function_exists( 'wp_set_auth_cookie' ) ) : * @since 2.5.0 * @since 4.3.0 Added the `$token` parameter. * - * @param int $user_id User ID. - * @param bool $remember Whether to remember the user. - * @param mixed $secure Whether the admin cookies should only be sent over HTTPS. - * Default is the value of is_ssl(). - * @param string $token Optional. User's session token to use for this cookie. + * @param int $user_id User ID. + * @param bool $remember Whether to remember the user. + * @param bool|string $secure Whether the auth cookie should only be sent over HTTPS. Default is an empty + * string which means the value of `is_ssl()` will be used. + * @param string $token Optional. User's session token to use for this cookie. */ function wp_set_auth_cookie( $user_id, $remember = false, $secure = '', $token = '' ) { if ( $remember ) { diff --git a/wp-includes/query.php b/wp-includes/query.php index f1053aac7b..4682e51662 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -225,7 +225,7 @@ function is_attachment( $attachment = '' ) { * * @global WP_Query $wp_query WordPress Query object. * - * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames + * @param int|string|int[]|string[] $author Optional. User ID, nickname, nicename, or array of such to check against. * @return bool */ function is_author( $author = '' ) { @@ -253,7 +253,7 @@ function is_author( $author = '' ) { * * @global WP_Query $wp_query WordPress Query object. * - * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs. + * @param int|string|int[]|string[] $category Optional. Category ID, name, slug, or array of such to check against. * @return bool */ function is_category( $category = '' ) { @@ -281,7 +281,7 @@ function is_category( $category = '' ) { * * @global WP_Query $wp_query WordPress Query object. * - * @param mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs. + * @param int|string|int[]|string[] $tag Optional. Tag ID, name, slug, or array of such to check against. * @return bool */ function is_tag( $tag = '' ) { @@ -313,8 +313,8 @@ function is_tag( $tag = '' ) { * * @global WP_Query $wp_query WordPress Query object. * - * @param string|array $taxonomy Optional. Taxonomy slug or slugs. - * @param int|string|array $term Optional. Term ID, name, slug or array of Term IDs, names, and slugs. + * @param string|string[] $taxonomy Optional. Taxonomy slug or slugs to check against. + * @param int|string|int[]|string[] $term Optional. Term ID, name, slug, or array of such to check against. * @return bool True for custom taxonomy archive pages, false for built-in taxonomies (category and tag archives). */ function is_tax( $taxonomy = '', $term = '' ) { diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php index 245d2d4d5a..5cc85738ac 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php @@ -342,7 +342,7 @@ class WP_REST_Autosaves_Controller extends WP_REST_Revisions_Controller { * * @since 5.0.0 * - * @param mixed $post_data Associative array containing the post data. + * @param array $post_data Associative array containing the post data. * @return mixed The autosave revision ID or WP_Error. */ public function create_post_autosave( $post_data ) { diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php index 83979c2891..3d966ded4d 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php @@ -1235,7 +1235,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { * * @since 4.7.0 * - * @param mixed $value The username submitted in the request. + * @param string $value The username submitted in the request. * @param WP_REST_Request $request Full details about the request. * @param string $param The parameter name. * @return string|WP_Error The sanitized username, if valid, otherwise an error. @@ -1272,7 +1272,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { * * @since 4.7.0 * - * @param mixed $value The password submitted in the request. + * @param string $value The password submitted in the request. * @param WP_REST_Request $request Full details about the request. * @param string $param The parameter name. * @return string|WP_Error The sanitized password, if valid, otherwise an error. diff --git a/wp-includes/version.php b/wp-includes/version.php index a0fdfd8799..652a67b890 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-beta3-47396'; +$wp_version = '5.4-beta3-47397'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.