Make WordPress Core

Changeset 61766

Timestamp:
02/27/2026 11:07:25 PM (5 days ago)
Author:
westonruter
Message:

Code Quality: Replace void with null in union return types in link-template.php.

Developed in https://github.com/WordPress/wordpress-develop/pull/11004

Follow-up to r61719, r61716, r32598.

Props apermo, xate, westonruter, noruzzaman.
See #64694, #64238.
Fixes #64699.

File:
1 edited

Legend:

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

    r61649 r61766  
    11321132 * @param int|WP_Term|null $term    Optional. Term ID or object. If null, the queried object will be inspected. Default null.
    11331133 * @param bool             $display Optional. Whether or not to echo the return. Default true.
    1134  * @return string|void HTML content.
     1134 * @return string| HTML content.
    11351135 */
    11361136function edit_term_link( $link = '', $before = '', $after = '', $term = null, $display = true ) {
     
    11421142
    11431143    if ( ! $term ) {
    1144         return;
     1144        return;
    11451145    }
    11461146
    11471147    $tax = get_taxonomy( $term->taxonomy );
    11481148    if ( ! current_user_can( 'edit_term', $term->term_id ) ) {
    1149         return;
     1149        return;
    11501150    }
    11511151
     
    15531553 * @param string      $deprecated   Not used.
    15541554 * @param bool        $force_delete Optional. Whether to bypass Trash and force deletion. Default false.
    1555  * @return string|void The delete post link URL for the given post.
     1555 * @return string| The delete post link URL for the given post.
    15561556 */
    15571557function get_delete_post_link( $post = 0, $deprecated = '', $force_delete = false ) {
     
    15631563
    15641564    if ( ! $post ) {
    1565         return;
     1565        return;
    15661566    }
    15671567
     
    15691569
    15701570    if ( ! $post_type_object ) {
    1571         return;
     1571        return;
    15721572    }
    15731573
    15741574    if ( ! current_user_can( 'delete_post', $post->ID ) ) {
    1575         return;
     1575        return;
    15761576    }
    15771577
     
    16011601 * @param string         $context    Optional. Context in which the URL should be used. Either 'display',
    16021602 *                                   to include HTML entities, or 'url'. Default 'display'.
    1603  * @return string|void The edit comment link URL for the given comment, or void if the comment id does not exist or
     1603 * @return string| does not exist or
    16041604 *                     the current user is not allowed to edit it.
    16051605 */
     
    16081608
    16091609    if ( ! is_object( $comment ) || ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
    1610         return;
     1610        return;
    16111611    }
    16121612
     
    16751675 *
    16761676 * @param int|stdClass $link Optional. Bookmark ID. Default is the ID of the current bookmark.
    1677  * @return string|void The edit bookmark link URL.
     1677 * @return string| The edit bookmark link URL.
    16781678 */
    16791679function get_edit_bookmark_link( $link = 0 ) {
     
    16811681
    16821682    if ( ! current_user_can( 'manage_links' ) ) {
    1683         return;
     1683        return;
    16841684    }
    16851685
     
    20582058 *                                     Default true.
    20592059 * @param string       $taxonomy       Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
    2060  * @return string|void The adjacent post relational link URL.
     2060 * @return string| The adjacent post relational link URL.
    20612061 */
    20622062function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
     
    20692069
    20702070    if ( empty( $post ) ) {
    2071         return;
     2071        return;
    20722072    }
    20732073
     
    25162516 *
    25172517 * @param int $max_page Optional. Max pages. Default 0.
    2518  * @return string|void The link URL for next posts page.
     2518 * @return string| The link URL for next posts page.
    25192519 */
    25202520function get_next_posts_page_link( $max_page = 0 ) {
     
    25412541 * @param int  $max_page Optional. Max pages. Default 0.
    25422542 * @param bool $display  Optional. Whether to echo the link. Default true.
    2543  * @return string|void The link URL for next posts page if `$display = false`.
     2543 * @return string| The link URL for next posts page if `$display = false`.
    25442544 */
    25452545function next_posts( $max_page = 0, $display = true ) {
     
    25642564 * @param string $label    Content for link text.
    25652565 * @param int    $max_page Optional. Max pages. Default 0.
    2566  * @return string|void HTML-formatted next posts page link.
     2566 * @return string| HTML-formatted next posts page link.
    25672567 */
    25682568function get_next_posts_link( $label = null, $max_page = 0 ) {
     
    26252625 * @global int $paged
    26262626 *
    2627  * @return string|void The link for the previous posts page.
     2627 * @return string| The link for the previous posts page.
    26282628 */
    26292629function get_previous_posts_page_link() {
     
    26472647 *
    26482648 * @param bool $display Optional. Whether to echo the link. Default true.
    2649  * @return string|void The previous posts page link if `$display = false`.
     2649 * @return string| The previous posts page link if `$display = false`.
    26502650 */
    26512651function previous_posts( $display = true ) {
     
    26672667 *
    26682668 * @param string $label Optional. Previous page link text.
    2669  * @return string|void HTML-formatted previous page link.
     2669 * @return string| HTML-formatted previous page link.
    26702670 */
    26712671function get_previous_posts_link( $label = null ) {
     
    31253125 * @param int      $max_page Optional. Max page. Default 0.
    31263126 * @param int|null $page     Optional. Page number. Default null.
    3127  * @return string|void HTML-formatted link for the next page of comments.
     3127 * @return string| HTML-formatted link for the next page of comments.
    31283128 */
    31293129function get_next_comments_link( $label = '', $max_page = 0, $page = null ) {
     
    31313131
    31323132    if ( ! is_singular() ) {
    3133         return;
     3133        return;
    31343134    }
    31353135
     
    31533153
    31543154    if ( $next_page > $max_page ) {
    3155         return;
     3155        return;
    31563156    }
    31573157
     
    31973197 * @param string   $label Optional. Label for comments link text. Default empty.
    31983198 * @param int|null $page  Optional. Page number. Default null.
    3199  * @return string|void HTML-formatted link for the previous page of comments.
     3199 * @return string| HTML-formatted link for the previous page of comments.
    32003200 */
    32013201function get_previous_comments_link( $label = '', $page = null ) {
    32023202    if ( ! is_singular() ) {
    3203         return;
     3203        return;
    32043204    }
    32053205
     
    32093209
    32103210    if ( (int) $page <= 1 ) {
    3211         return;
     3211        return;
    32123212    }
    32133213
Note: See TracChangeset for help on using the changeset viewer.