From 27522d1c003df0961f19a2b8618672b7f10679a7 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 21 May 2015 21:05:24 +0000 Subject: [PATCH] In `category-template.php`: * Clarify/add some `return` docs. * In `walk_category_tree()` and `walk_category_dropdown_tree()`, make behavior consistent and don't pass `$walker` by-reference - it is no longer necessary to do that with object instances. See #32444. Built from https://develop.svn.wordpress.org/trunk@32531 git-svn-id: http://core.svn.wordpress.org/trunk@32501 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/category-template.php | 35 ++++++++++++++++++------------- wp-includes/version.php | 2 +- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index 60748aab69..11753978f4 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -479,7 +479,7 @@ function wp_dropdown_categories( $args = '' ) { * @since 2.1.0 * * @param string|array $args Optional. Override default arguments. - * @return false|null|string HTML content only if 'echo' argument is 0. + * @return false|string HTML content only if 'echo' argument is 0. */ function wp_list_categories( $args = '' ) { $defaults = array( @@ -629,7 +629,8 @@ function wp_list_categories( $args = '' ) { * @since 2.3.0 * * @param array|string|null $args Optional. Override default arguments. - * @return null|false Generated tag cloud, only if no failures and 'array' is set for the 'format' argument. + * @return null|array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument. + * Otherwise, this function outputs the tag cloud. */ function wp_tag_cloud( $args = '' ) { $defaults = array( @@ -650,7 +651,7 @@ function wp_tag_cloud( $args = '' ) { else $link = get_term_link( intval($tag->term_id), $tag->taxonomy ); if ( is_wp_error( $link ) ) - return false; + return; $tags[ $key ]->link = $link; $tags[ $key ]->id = $tag->term_id; @@ -677,8 +678,8 @@ function wp_tag_cloud( $args = '' ) { /** * Default topic count scaling for tag links * - * @param integer $count number of posts with that tag - * @return integer scaled count + * @param int $count number of posts with that tag + * @return int scaled count */ function default_topic_count_scale( $count ) { return round(log10($count + 1) * 100); @@ -868,6 +869,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) { * * @since 3.1.0 * @access private + * @return int */ function _wp_object_name_sort_cb( $a, $b ) { return strnatcasecmp( $a->name, $b->name ); @@ -878,6 +880,7 @@ function _wp_object_name_sort_cb( $a, $b ) { * * @since 3.1.0 * @access private + * @return bool */ function _wp_object_count_sort_cb( $a, $b ) { return ( $a->count > $b->count ); @@ -893,6 +896,7 @@ function _wp_object_count_sort_cb( $a, $b ) { * @uses Walker_Category to create HTML list content. * @since 2.1.0 * @see Walker_Category::walk() for parameters and return description. + * @return string */ function walk_category_tree() { $args = func_get_args(); @@ -902,7 +906,7 @@ function walk_category_tree() { } else { $walker = $args[2]['walker']; } - return call_user_func_array(array( &$walker, 'walk' ), $args ); + return call_user_func_array( array( $walker, 'walk' ), $args ); } /** @@ -911,16 +915,17 @@ function walk_category_tree() { * @uses Walker_CategoryDropdown to create HTML dropdown content. * @since 2.1.0 * @see Walker_CategoryDropdown::walk() for parameters and return description. + * @return string */ function walk_category_dropdown_tree() { $args = func_get_args(); // the user's options are the third parameter - if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') ) + if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) { $walker = new Walker_CategoryDropdown; - else + } else { $walker = $args[2]['walker']; - - return call_user_func_array(array( &$walker, 'walk' ), $args ); + } + return call_user_func_array( array( $walker, 'walk' ), $args ); } /** @@ -1214,7 +1219,7 @@ function get_tag_link( $tag ) { * @since 2.3.0 * * @param int $id Post ID. - * @return array|bool Array of tag objects on success, false on failure. + * @return array|false|WP_Error Array of tag objects on success, false on failure. */ function get_the_tags( $id = 0 ) { @@ -1239,7 +1244,7 @@ function get_the_tags( $id = 0 ) { * @param string $sep Optional. Between tags. * @param string $after Optional. After tags. * @param int $id Optional. Post ID. Defaults to the current post. - * @return string|bool|WP_Error A list of tags on success, false if there are no terms, WP_Error on failure. + * @return string|false|WP_Error A list of tags on success, false if there are no terms, WP_Error on failure. */ function get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 ) { @@ -1312,8 +1317,8 @@ function term_description( $term = 0, $taxonomy = 'post_tag' ) { * * @param int|object $post Post ID or object. * @param string $taxonomy Taxonomy name. - * @return array|bool|WP_Error Array of term objects on success, false if there are no terms - * or the post does not exist, WP_Error on failure. + * @return array|false|WP_Error Array of term objects on success, false if there are no terms + * or the post does not exist, WP_Error on failure. */ function get_the_terms( $post, $taxonomy ) { if ( ! $post = get_post( $post ) ) @@ -1352,7 +1357,7 @@ function get_the_terms( $post, $taxonomy ) { * @param string $before Optional. Before list. * @param string $sep Optional. Separate items using this. * @param string $after Optional. After list. - * @return string|bool|WP_Error A list of terms on success, false if there are no terms, WP_Error on failure. + * @return string|false|WP_Error A list of terms on success, false if there are no terms, WP_Error on failure. */ function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) { $terms = get_the_terms( $id, $taxonomy ); diff --git a/wp-includes/version.php b/wp-includes/version.php index d05611c742..0a182a8726 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-alpha-32530'; +$wp_version = '4.3-alpha-32531'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.