Changeset 63441
- Timestamp:
- 09/02/2026 07:08:14 PM (3 months ago)
- Location:
- trunk/src
- Files:
-
- 11 edited
-
wp-content/themes/twentytwenty/inc/template-tags.php (modified) (2 diffs)
-
wp-includes/author-template.php (modified) (1 diff)
-
wp-includes/bookmark-template.php (modified) (1 diff)
-
wp-includes/category-template.php (modified) (3 diffs)
-
wp-includes/comment-template.php (modified) (7 diffs)
-
wp-includes/functions.php (modified) (1 diff)
-
wp-includes/general-template.php (modified) (22 diffs)
-
wp-includes/l10n.php (modified) (1 diff)
-
wp-includes/link-template.php (modified) (8 diffs)
-
wp-includes/post-template.php (modified) (6 diffs)
-
wp-includes/user.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentytwenty/inc/template-tags.php
r61676 r63441 108 108 * 109 109 * @param bool $display Display or return the HTML. 110 * @return string|void The HTML to display. 110 * @return string|void The HTML when `$display` is false, null when the site has no 111 * description. Nothing otherwise. 112 * @phpstan-return ( $display is true ? void : string|null ) 111 113 */ 112 114 function twentytwenty_site_description( $display = true ) { … … 114 116 115 117 if ( ! $description ) { 116 return ;118 return null; 117 119 } 118 120 -
trunk/src/wp-includes/author-template.php
r62091 r63441 450 450 * @type int[]|string $include Array or comma/space-separated list of author IDs to include. Default empty. 451 451 * } 452 * @return void|string Void if 'echo' argument is true, list of authors if 'echo' is false. 452 * @return string|void List of authors if 'echo' is false, nothing otherwise. 453 * @phpstan-return ( 454 * $args is array{ echo: false|0|''|'0', ... } 455 * ? string 456 * : ( $args is ''|array ? void : string|null ) 457 * ) 453 458 */ 454 459 function wp_list_authors( $args = '' ) { -
trunk/src/wp-includes/bookmark-template.php
r60058 r63441 207 207 * Default 'ASC'. 208 208 * } 209 * @return void|string Void if 'echo' argument is true, HTML list of bookmarks if 'echo' is false. 209 * @return string|void HTML list of bookmarks if 'echo' is false, nothing otherwise. 210 * @phpstan-return ( 211 * $args is array{ echo: false|0|''|'0', ... } 212 * ? string 213 * : ( $args is ''|array ? void : string|null ) 214 * ) 210 215 */ 211 216 function wp_list_bookmarks( $args = '' ) { -
trunk/src/wp-includes/category-template.php
r63030 r63441 711 711 * @type bool $echo Whether or not to echo the return value. Default true. 712 712 * } 713 * @return void|string|string[] Void if 'echo' argument is true, or on failure. Otherwise, tag cloud 714 * as a string or an array, depending on 'format' argument. 713 * @return string|string[]|void Tag cloud as a string, or as an array when the 'format' argument 714 * is 'array'. Null on failure. Nothing when 'echo' is true and 715 * 'format' is not 'array'. 716 * @phpstan-return ( 717 * $args is array{ format: 'array', ... } 718 * ? string[]|null 719 * : ( $args is array{ echo: false|0|''|'0', ... } 720 * ? string|null 721 * : ( $args is ''|array ? void : string|string[]|null ) ) 722 * ) 715 723 */ 716 724 function wp_tag_cloud( $args = '' ) { … … 746 754 747 755 if ( empty( $tags ) || is_wp_error( $tags ) ) { 748 return ;756 return null; 749 757 } 750 758 … … 757 765 758 766 if ( is_wp_error( $link ) ) { 759 return ;767 return null; 760 768 } 761 769 -
trunk/src/wp-includes/comment-template.php
r62324 r63441 489 489 * @param bool $display Optional. Whether to print or return the output. 490 490 * Default true. 491 * @return void|string Void if `$display` argument is true, comment classes if `$display` is false. 491 * @return string|void Comment classes if `$display` is false, nothing otherwise. 492 * @phpstan-return ( $display is true ? void : string ) 492 493 */ 493 494 function comment_class( $css_class = '', $comment = null, $post = null, $display = true ) { … … 1240 1241 * 1241 1242 * @since 0.71 1242 * 1243 * @param bool $deprecated_echo Not used. 1244 * @return void|string Should only be used to echo the trackback URL, use get_trackback_url() 1245 * for the result instead. 1243 * @since 2.5.0 Deprecated the `$deprecated_echo` argument. 1244 * 1245 * @see get_trackback_url() 1246 * 1247 * @param bool $deprecated_echo Deprecated. Use {@see get_trackback_url()}. Echo the URL or 1248 * return it. Default true. 1249 * @return string|void The trackback URL when `$deprecated_echo` is false, nothing otherwise. 1250 * @phpstan-return ( $deprecated_echo is true ? void : string ) 1246 1251 */ 1247 1252 function trackback_url( $deprecated_echo = true ) { … … 2229 2234 * } 2230 2235 * @param WP_Comment[] $comments Optional. Array of WP_Comment objects. Default null. 2231 * @return void|string Void if 'echo' argument is true, or no comments to list. 2232 * Otherwise, HTML list of comments. 2236 * @return string|void HTML list of comments when 'echo' is false, null when there are no 2237 * comments to list. Nothing otherwise. 2238 * @phpstan-return ( 2239 * $args is array{ echo: false|0|''|'0', ... } 2240 * ? string|null 2241 * : ( $args is ''|array ? void : string|null ) 2242 * ) 2233 2243 */ 2234 2244 function wp_list_comments( $args = array(), $comments = null ) { … … 2275 2285 $comments = (array) $comments; 2276 2286 if ( empty( $comments ) ) { 2277 return ;2287 return null; 2278 2288 } 2279 2289 if ( 'all' !== $parsed_args['type'] ) { 2280 2290 $comments_by_type = separate_comments( $comments ); 2281 2291 if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) { 2282 return ;2292 return null; 2283 2293 } 2284 2294 $_comments = $comments_by_type[ $parsed_args['type'] ]; … … 2321 2331 $comments_by_type = separate_comments( $comments ); 2322 2332 if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) { 2323 return ;2333 return null; 2324 2334 } 2325 2335 … … 2333 2343 } else { 2334 2344 if ( empty( $wp_query->comments ) ) { 2335 return ;2345 return null; 2336 2346 } 2337 2347 if ( 'all' !== $parsed_args['type'] ) { … … 2340 2350 } 2341 2351 if ( empty( $wp_query->comments_by_type[ $parsed_args['type'] ] ) ) { 2342 return ;2352 return null; 2343 2353 } 2344 2354 $_comments = $wp_query->comments_by_type[ $parsed_args['type'] ]; -
trunk/src/wp-includes/functions.php
r63420 r63441 8738 8738 * @param string $after Markup to output after the annotation. Default `</p>`. 8739 8739 * @param bool $display Whether to echo or return the markup. Default `true` for echo. 8740 * @return string|null Update PHP page annotation if available and $display is false, null otherwise. 8740 * @return string|void Update PHP page annotation when `$display` is false, null when no 8741 * annotation is available. Nothing otherwise. 8742 * @phpstan-return ( $display is true ? void : string|null ) 8741 8743 */ 8742 8744 function wp_update_php_annotation( $before = '<p class="description">', $after = '</p>', $display = true ) { 8743 8745 $annotation = wp_get_update_php_annotation(); 8744 8746 8745 if ( $annotation ) { 8746 if ( $display ) { 8747 echo $before . $annotation . $after; 8748 } else { 8749 return $before . $annotation . $after; 8750 } 8751 } 8752 return null; 8747 if ( ! $annotation ) { 8748 return null; 8749 } 8750 8751 if ( ! $display ) { 8752 return $before . $annotation . $after; 8753 } 8754 8755 echo $before . $annotation . $after; 8753 8756 } 8754 8757 -
trunk/src/wp-includes/general-template.php
r63379 r63441 237 237 * accessibility. Default empty. 238 238 * } 239 * @return void|string Void if 'echo' argument is true, search form HTML if 'echo' is false. 239 * @return string|void Search form HTML if 'echo' is false, nothing otherwise. 240 * @phpstan-param array<string, mixed>|bool $args 241 * @phpstan-return ( 242 * $args is array{ echo: false|0|''|'0', ... } 243 * ? string 244 * : ( $args is false|0|''|'0' ? string : void ) 245 * ) 240 246 */ 241 247 function get_search_form( $args = array() ) { … … 582 588 * @param string $redirect Optional path to redirect to on login/logout. 583 589 * @param bool $display Default to echo and not return the link. 584 * @return void|string Void if `$display` argument is true, log in/out link if `$display` is false. 590 * @return string|void Log in/out link if `$display` is false, nothing otherwise. 591 * @phpstan-return ( $display is true ? void : string ) 585 592 */ 586 593 function wp_loginout( $redirect = '', $display = true ) { … … 722 729 * 723 730 * } 724 * @return void|string Void if 'echo' argument is true, login form HTML if 'echo' is false. 731 * @return string|void Login form HTML if 'echo' is false, nothing otherwise. 732 * @phpstan-return ( $args is array{ echo: false|0|''|'0', ... } ? string : void ) 725 733 */ 726 734 function wp_login_form( $args = array() ) { … … 902 910 * @param string $after Text to output after the link. Default `</li>`. 903 911 * @param bool $display Default to echo and not return the link. 904 * @return void|string Void if `$display` argument is true, registration or admin link 905 * if `$display` is false. 912 * @return string|void The registration or admin link when `$display` is false, or an empty 913 * string when registration is disabled or the logged-in user cannot 914 * access the dashboard. Nothing otherwise. 915 * @phpstan-return ( $display is true ? void : string ) 906 916 */ 907 917 function wp_register( $before = '<li>', $after = '</li>', $display = true ) { … … 1544 1554 * @param bool $display Optional. Whether to display or retrieve title. Default true. 1545 1555 * @param string $seplocation Optional. Location of the separator (either 'left' or 'right'). 1546 * @return string|null String when `$display` is false, null otherwise. 1556 * @return string|void String when `$display` is false, nothing otherwise. 1557 * @phpstan-return ( $display is true ? void : string ) 1547 1558 */ 1548 1559 function wp_title( $sep = '»', $display = true, $seplocation = '' ) { … … 1679 1690 1680 1691 echo $title; 1681 1682 return null;1683 1692 } 1684 1693 … … 1697 1706 * @param string $prefix Optional. What to display before the title. 1698 1707 * @param bool $display Optional. Whether to display or retrieve title. Default true. 1699 * @return string|null Title when retrieving. 1708 * @return string|void Title when retrieving, null on failure. 1709 * Nothing when displaying. 1710 * @phpstan-return ( $display is true ? void : string|null ) 1700 1711 */ 1701 1712 function single_post_title( $prefix = '', $display = true ) { … … 1721 1732 1722 1733 echo $prefix . $title; 1723 1724 return null;1725 1734 } 1726 1735 … … 1735 1744 * @param string $prefix Optional. What to display before the title. 1736 1745 * @param bool $display Optional. Whether to display or retrieve title. Default true. 1737 * @return string|null Title when retrieving, null when displaying or on failure. 1746 * @return string|void Title when retrieving, null on failure. 1747 * Nothing when displaying. 1748 * @phpstan-return ( $display is true ? void : string|null ) 1738 1749 */ 1739 1750 function post_type_archive_title( $prefix = '', $display = true ) { … … 1764 1775 1765 1776 echo $prefix . $title; 1766 1767 return null;1768 1777 } 1769 1778 … … 1779 1788 * @param string $prefix Optional. What to display before the title. 1780 1789 * @param bool $display Optional. Whether to display or retrieve title. Default true. 1781 * @return string|null Title when retrieving. 1790 * @return string|void Title when retrieving, null on failure. 1791 * Nothing when displaying. 1792 * @phpstan-return ( $display is true ? void : string|null ) 1782 1793 */ 1783 1794 function single_cat_title( $prefix = '', $display = true ) { 1784 return single_term_title( $prefix, $display ); 1795 if ( ! $display ) { 1796 return single_term_title( $prefix, false ); 1797 } 1798 1799 single_term_title( $prefix, true ); 1785 1800 } 1786 1801 … … 1796 1811 * @param string $prefix Optional. What to display before the title. 1797 1812 * @param bool $display Optional. Whether to display or retrieve title. Default true. 1798 * @return string|null Title when retrieving. 1813 * @return string|void Title when retrieving, null on failure. 1814 * Nothing when displaying. 1815 * @phpstan-return ( $display is true ? void : string|null ) 1799 1816 */ 1800 1817 function single_tag_title( $prefix = '', $display = true ) { 1801 return single_term_title( $prefix, $display ); 1818 if ( ! $display ) { 1819 return single_term_title( $prefix, false ); 1820 } 1821 1822 single_term_title( $prefix, true ); 1802 1823 } 1803 1824 … … 1813 1834 * @param string $prefix Optional. What to display before the title. 1814 1835 * @param bool $display Optional. Whether to display or retrieve title. Default true. 1815 * @return string|null Title when retrieving. 1836 * @return string|void Title when retrieving, null on failure. 1837 * Nothing when displaying. 1838 * @phpstan-return ( $display is true ? void : string|null ) 1816 1839 */ 1817 1840 function single_term_title( $prefix = '', $display = true ) { … … 1862 1885 1863 1886 echo $prefix . $term_name; 1864 1865 return null;1866 1887 } 1867 1888 … … 2215 2236 * @type string $w Week. Default current week. 2216 2237 * } 2217 * @return void|string Void if 'echo' argument is true, archive links if 'echo' is false. 2238 * @return string|void Archive links when 'echo' is false, null when the post type is 2239 * not viewable. Nothing otherwise. 2240 * @phpstan-return ( 2241 * $args is array{ echo: false|0|''|'0', ... } 2242 * ? string|null 2243 * : ( $args is ''|array ? void : string|null ) 2244 * ) 2218 2245 */ 2219 2246 function wp_get_archives( $args = '' ) { … … 2251 2278 $post_type_object = get_post_type_object( $parsed_args['post_type'] ); 2252 2279 if ( ! is_post_type_viewable( $post_type_object ) ) { 2253 return ;2280 return null; 2254 2281 } 2255 2282 … … 2485 2512 * @type string $post_type Optional. Post type. Default 'post'. 2486 2513 * } 2487 * @return void|string Void if `$display` argument is true, calendar HTML if `$display` is false. 2514 * @return string|void Calendar HTML when `$display` is false, null when the site has 2515 * no posts. Nothing otherwise. 2516 * @phpstan-return ( $args is array{ display: false|0|''|'0', ... } ? string|null : void ) 2488 2517 */ 2489 2518 function get_calendar( $args = array() ) { … … 2596 2625 $cache[ $key ] = ''; 2597 2626 wp_cache_set( 'get_calendar', $cache, 'calendar' ); 2598 return ;2627 return null; 2599 2628 } 2600 2629 } … … 2899 2928 * @param string $after Optional. Output after the date. Default empty. 2900 2929 * @param bool $display Optional. Whether to echo the date or return it. Default true. 2901 * @return string|null String if retrieving. 2930 * @return string|void String if retrieving. 2931 * @phpstan-return ( $display is true ? void : string ) 2902 2932 */ 2903 2933 function the_date( $format = '', $before = '', $after = '', $display = true ) { … … 2928 2958 2929 2959 echo $the_date; 2930 2931 return null;2932 2960 } 2933 2961 … … 2976 3004 * @param string $after Optional. Output after the date. Default empty. 2977 3005 * @param bool $display Optional. Whether to echo the date or return it. Default true. 2978 * @return string|null String if retrieving. 3006 * @return string|void String if retrieving. 3007 * @phpstan-return ( $display is true ? void : string ) 2979 3008 */ 2980 3009 function the_modified_date( $format = '', $before = '', $after = '', $display = true ) { … … 2998 3027 2999 3028 echo $the_modified_date; 3000 3001 return null;3002 3029 } 3003 3030 -
trunk/src/wp-includes/l10n.php
r63320 r63441 1736 1736 * instead of an empty value. Default false. 1737 1737 * } 1738 * @return string|void HTML dropdown list of languages. 1738 * @return string|void HTML dropdown list of languages. Always returned, whether or not 1739 * 'echo' is true; nothing is returned when the required `id` or `name` 1740 * argument is missing. 1739 1741 */ 1740 1742 function wp_dropdown_languages( $args = array() ) { -
trunk/src/wp-includes/link-template.php
r63420 r63441 1132 1132 * @param int|WP_Term|null $term Optional. Term ID or object. If null, the queried object will be inspected. Default null. 1133 1133 * @param bool $display Optional. Whether or not to echo the return. Default true. 1134 * @return string|null HTML content. 1134 * @return string|void HTML content when retrieving, null on failure or without the 1135 * capability to edit the term. Nothing when displaying. 1136 * @phpstan-return ( $display is true ? void : string|null ) 1135 1137 */ 1136 1138 function edit_term_link( $link = '', $before = '', $after = '', $term = null, $display = true ) { … … 1170 1172 1171 1173 echo $link; 1172 1173 return null;1174 1174 } 1175 1175 … … 2544 2544 * @param int $max_page Optional. Max pages. Default 0. 2545 2545 * @param bool $display Optional. Whether to echo the link. Default true. 2546 * @return string|null The link URL for next posts page if `$display = false`. 2546 * @return string|void The next posts page link when `$display` is false, or an empty 2547 * string when there is no next page. Nothing otherwise. 2548 * @phpstan-return ( $display is true ? void : string ) 2547 2549 */ 2548 2550 function next_posts( $max_page = 0, $display = true ) { … … 2555 2557 2556 2558 echo $output; 2557 2558 return null;2559 2559 } 2560 2560 … … 2656 2656 * 2657 2657 * @param bool $display Optional. Whether to echo the link. Default true. 2658 * @return string|null The previous posts page link if `$display = false`. 2658 * @return string|void The previous posts page link when `$display` is false, or an empty 2659 * string when there is no previous page. Nothing otherwise. 2660 * @phpstan-return ( $display is true ? void : string ) 2659 2661 */ 2660 2662 function previous_posts( $display = true ) { … … 2667 2669 2668 2670 echo $output; 2669 2670 return null;2671 2671 } 2672 2672 … … 3269 3269 * 3270 3270 * @param string|array $args Optional args. See paginate_links(). Default empty array. 3271 * @return void|string|array Void if 'echo' argument is true and 'type' is not an array, 3272 * or if the query is not for an existing single post of any post type. 3273 * Otherwise, markup for comment page links or array of comment page links, 3274 * depending on 'type' argument. 3271 * @return string|string[]|void Markup for comment page links, or an array of them when the 'type' 3272 * argument is 'array'. Null if the query is not for an existing single 3273 * post of any post type. Nothing when 'echo' is true and 'type' is not 3274 * 'array'. 3275 * @phpstan-return ( 3276 * $args is array{ type: 'array', ... } 3277 * ? string[]|null 3278 * : ( $args is array{ echo: false|0|''|'0', ... } 3279 * ? string|null 3280 * : ( $args is ''|array ? void : string|string[]|null ) ) 3281 * ) 3275 3282 */ 3276 3283 function paginate_comments_links( $args = array() ) { … … 3278 3285 3279 3286 if ( ! is_singular() ) { 3280 return ;3287 return null; 3281 3288 } 3282 3289 -
trunk/src/wp-includes/post-template.php
r63404 r63441 38 38 * @param string $after Optional. Markup to append to the title. Default empty. 39 39 * @param bool $display Optional. Whether to echo or return the title. Default true for echo. 40 * @return void|string Void if `$display` argument is true or the title is empty, 41 * current post title if `$display` is false. 40 * @return string|void Current post title when `$display` is false, null when the title 41 * is empty. Nothing otherwise. 42 * @phpstan-return ( $display is true ? void : string|null ) 42 43 */ 43 44 function the_title( $before = '', $after = '', $display = true ) { … … 45 46 46 47 if ( strlen( $title ) === 0 ) { 47 return ;48 return null; 48 49 } 49 50 … … 77 78 * @type WP_Post $post Current post object to retrieve the title for. 78 79 * } 79 * @return void|string Void if 'echo' argument is true, the title attribute if 'echo' is false. 80 * @return string|void The title attribute when 'echo' is false, null when the title is 81 * empty. Nothing otherwise. 82 * @phpstan-return ( 83 * $args is array{ echo: false|0|''|'0', ... } 84 * ? string|null 85 * : ( $args is ''|array ? void : string|null ) 86 * ) 80 87 */ 81 88 function the_title_attribute( $args = '' ) { … … 91 98 92 99 if ( strlen( $title ) === 0 ) { 93 return ;100 return null; 94 101 } 95 102 … … 1299 1306 * Walker_Page instance being used. 1300 1307 * } 1301 * @return void|string Void if 'echo' argument is true, HTML list of pages if 'echo' is false. 1308 * @return string|void HTML list of pages if 'echo' is false, nothing otherwise. 1309 * @phpstan-return ( 1310 * $args is array{ echo: false|0|''|'0', ... } 1311 * ? string 1312 * : ( $args is ''|array ? void : string|null ) 1313 * ) 1302 1314 */ 1303 1315 function wp_list_pages( $args = '' ) { … … 1422 1434 * Walker_Page instance being used. 1423 1435 * } 1424 * @return void|string Void if 'echo' argument is true, HTML menu if 'echo' is false. 1436 * @return string|void HTML menu if 'echo' is false, nothing otherwise. 1437 * @phpstan-return ( 1438 * $args is array{ echo: false|0|''|'0', ... } 1439 * ? string 1440 * : ( $args is ''|array ? void : string|null ) 1441 * ) 1425 1442 */ 1426 1443 function wp_page_menu( $args = array() ) { -
trunk/src/wp-includes/user.php
r63378 r63441 908 908 * @type string $include An array, comma-, or space-separated list of user IDs to include. Default empty. 909 909 * } 910 * @return string|null The output if echo is false. Otherwise null. 910 * @return string|void The output if 'echo' is false, nothing otherwise. 911 * @phpstan-return ( 912 * $args is array{ echo: false|0|''|'0', ... } 913 * ? string 914 * : ( $args is ''|array ? void : string|null ) 915 * ) 911 916 */ 912 917 function wp_list_users( $args = array() ) { … … 1016 1021 1017 1022 echo $return; 1018 1019 return null;1020 1023 } 1021 1024
Note:
See TracChangeset
for help on using the changeset viewer.