WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/11/2020 06:30:58 PM (13 months ago)
Author:
SergeyBiryukov
Message:

Docs: In various @return tags, list the expected type first, instead of false.

Follow-up to [46696].

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/category-template.php

    r46823 r47060  
    479479 *                                               'current-cat' class. Default 0.
    480480 *     @type int          $depth                 Category depth. Used for tab indentation. Default 0.
    481  *     @type bool|int     $echo                  True to echo markup, false to return it. Default 1.
     481 *     @type bool|int     $echo                  Whether to echo or return the generated markup. Accepts 0, 1, or their
     482 *                                               bool equivalents. Default 1.
    482483 *     @type array|string $exclude               Array or comma/space-separated string of term IDs to exclude.
    483484 *                                               If `$hierarchical` is true, descendants of `$exclude` terms will also
     
    494495 *                                               the list. Default false (title will always be shown).
    495496 *     @type string       $separator             Separator between links. Default '<br />'.
    496  *     @type bool|int     $show_count            Whether to show how many posts are in the category. Default 0.
     497 *     @type bool|int     $show_count            Whether to include post counts. Accepts 0, 1, or their bool equivalents.
     498 *                                               Default 0.
    497499 *     @type string       $show_option_all       Text to display for showing all categories. Default empty string.
    498500 *     @type string       $show_option_none      Text to display for the 'no categories' option.
     
    504506 *                                               to disable. Default 'Categories'.
    505507 *     @type bool|int     $use_desc_for_title    Whether to use the category description as the title attribute.
    506  *                                               Default 1.
     508 *                                               Accepts 0, 1, or their bool equivalents. Default 1.
    507509 * }
    508  * @return false|string HTML list of categories only if 'echo' argument is 0.
     510 * @return void|string|false Void if 'echo' argument is true, HTML list of categories if 'echo' is false.
     511 *                           False if the taxonomy does not exist.
    509512 */
    510513function wp_list_categories( $args = '' ) {
     
    672675 *     @type bool   $echo      Whether or not to echo the return value. Default true.
    673676 * }
    674  * @return void|array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument.
    675  *                    Otherwise, this function outputs the tag cloud.
     677 * @return void|string|array Void if 'echo' argument is true, or on failure. Otherwise, tag cloud
     678 *                           as a string or an array, depending on 'format' argument.
    676679 */
    677680function wp_tag_cloud( $args = '' ) {
     
    693696        'show_count' => 0,
    694697    );
    695     $args     = wp_parse_args( $args, $defaults );
     698
     699    $args = wp_parse_args( $args, $defaults );
    696700
    697701    $tags = get_terms(
     
    715719            $link = get_term_link( intval( $tag->term_id ), $tag->taxonomy );
    716720        }
     721
    717722        if ( is_wp_error( $link ) ) {
    718723            return;
     
    730735     * @since 2.3.0
    731736     *
    732      * @param string $return HTML output of the tag cloud.
    733      * @param array  $args   An array of tag cloud arguments.
     737     * @param string|array $return Tag cloud as a string or an array, depending on 'format' argument.
     738     * @param array        $args   An array of tag cloud arguments.
    734739     */
    735740    $return = apply_filters( 'wp_tag_cloud', $return, $args );
     
    12661271 * @since 2.5.0
    12671272 *
    1268  * @param int $id Post ID.
     1273 * @param int    $id      Post ID.
    12691274 * @param string $taxonomy Taxonomy name.
    1270  * @param string $before Optional. Before list.
    1271  * @param string $sep Optional. Separate items using this.
    1272  * @param string $after Optional. After list.
     1275 * @param string $before   Optional. Before list.
     1276 * @param string $sep      Optional. Separate items using this.
     1277 * @param string $after    Optional. After list.
    12731278 * @return string|false|WP_Error A list of terms on success, false if there are no terms, WP_Error on failure.
    12741279 */
     
    13791384 * @since 2.5.0
    13801385 *
    1381  * @param int $id Post ID.
     1386 * @param int    $id      Post ID.
    13821387 * @param string $taxonomy Taxonomy name.
    1383  * @param string $before Optional. Before list.
    1384  * @param string $sep Optional. Separate items using this.
    1385  * @param string $after Optional. After list.
    1386  * @return false|void False on WordPress error.
     1388 * @param string $before   Optional. Before list.
     1389 * @param string $sep      Optional. Separate items using this.
     1390 * @param string $after    Optional. After list.
     1391 * @return void|false False on WordPress error.
    13871392 */
    13881393function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
     
    14131418 *
    14141419 * @param string|int|array $category Optional. The category name/term_id/slug or array of them to check for.
    1415  * @param int|object $post Optional. Post to check instead of the current post.
     1420 * @param int|object       $post    Optional. Post to check instead of the current post.
    14161421 * @return bool True if the current post has any of the given categories (or any category, if no category specified).
    14171422 */
     
    14371442 * @since 2.6.0
    14381443 *
    1439  * @param string|int|array $tag Optional. The tag name/term_id/slug or array of them to check for.
    1440  * @param int|object $post Optional. Post to check instead of the current post. (since 2.7.0)
     1444 * @param string|int|array $tag  Optional. The tag name/term_id/slug or array of them to check for.
     1445 * @param int|object       $post Optional. Post to check instead of the current post. (since 2.7.0)
    14411446 * @return bool True if the current post has any of the given tags (or any tag, if no tag specified).
    14421447 */
Note: See TracChangeset for help on using the changeset viewer.