Make WordPress Core

Changeset 61649


Ignore:
Timestamp:
02/15/2026 11:17:55 PM (3 weeks ago)
Author:
SergeyBiryukov
Message:

Docs: Add missing null to $post parameter types in various functions.

Props apermo.
Fixes #64645.

Location:
trunk/src/wp-includes
Files:
9 edited

Legend:

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

    r61454 r61649  
    14881488 * @param string|int|array $category Optional. The category name/term_id/slug,
    14891489 *                                   or an array of them to check for. Default empty.
    1490  * @param int|WP_Post      $post     Optional. Post to check. Defaults to the current post.
     1490 * @param int|WP_Post|null $post     Optional. Post to check. Defaults to the current post.
    14911491 * @return bool True if the current post has any of the given categories
    14921492 *              (or any category, if no category specified). False otherwise.
     
    15151515 * @param string|int|array $tag  Optional. The tag name/term_id/slug,
    15161516 *                               or an array of them to check for. Default empty.
    1517  * @param int|WP_Post      $post Optional. Post to check. Defaults to the current post.
     1517 * @param int|WP_Post|null $post Optional. Post to check. Defaults to the current post.
    15181518 * @return bool True if the current post has any of the given tags
    15191519 *              (or any tag, if no tag specified). False otherwise.
     
    15361536 *                                   or an array of them to check for. Default empty.
    15371537 * @param string           $taxonomy Optional. Taxonomy name. Default empty.
    1538  * @param int|WP_Post      $post     Optional. Post to check. Defaults to the current post.
     1538 * @param int|WP_Post|null $post     Optional. Post to check. Defaults to the current post.
    15391539 * @return bool True if the current post has any of the given terms
    15401540 *              (or any term, if no term specified). False otherwise.
  • trunk/src/wp-includes/comment-template.php

    r61034 r61649  
    21582158 * @access private
    21592159 *
    2160  * @param int|WP_Post $post The post the comment is being displayed for.
    2161  *                          Defaults to the current global post.
     2160 * @param int|WP_Post|null $post The post the comment is being displayed for.
     2161 *                               Defaults to the current global post.
    21622162 * @return int Comment's reply to ID.
    21632163 */
  • trunk/src/wp-includes/embed.php

    r61453 r61649  
    414414 * @since 4.4.0
    415415 *
    416  * @param int|WP_Post $post Optional. Post ID or object. Defaults to the current post.
     416 * @param int|WP_Post|null $post Optional. Post ID or object. Defaults to the current post.
    417417 * @return string|false The post embed URL on success, false if the post doesn't exist.
    418418 */
     
    483483 * @since 4.4.0
    484484 *
    485  * @param int         $width  The width for the response.
    486  * @param int         $height The height for the response.
    487  * @param int|WP_Post $post   Optional. Post ID or object. Default is global `$post`.
     485 * @param int              $width  The width for the response.
     486 * @param int              $height The height for the response.
     487 * @param int|WP_Post|null $post   Optional. Post ID or object. Default is global `$post`.
    488488 * @return string|false Embed code on success, false if post doesn't exist.
    489489 */
  • trunk/src/wp-includes/general-template.php

    r61644 r61649  
    27172717 * @since 3.0.0
    27182718 *
    2719  * @param string      $format Optional. PHP date format. Defaults to the 'date_format' option.
    2720  * @param int|WP_Post $post   Optional. Post ID or WP_Post object. Default current post.
     2719 * @param string           $format Optional. PHP date format. Defaults to the 'date_format' option.
     2720 * @param int|WP_Post|null $post   Optional. Post ID or WP_Post object. Default current post.
    27212721 * @return string|int|false Date the current post was written. False on failure.
    27222722 */
     
    27832783 * @since 4.6.0 Added the `$post` parameter.
    27842784 *
    2785  * @param string      $format Optional. PHP date format. Defaults to the 'date_format' option.
    2786  * @param int|WP_Post $post   Optional. Post ID or WP_Post object. Default current post.
     2785 * @param string           $format Optional. PHP date format. Defaults to the 'date_format' option.
     2786 * @param int|WP_Post|null $post   Optional. Post ID or WP_Post object. Default current post.
    27872787 * @return string|int|false Date the current post was modified. False on failure.
    27882788 */
     
    28392839 * @since 1.5.0
    28402840 *
    2841  * @param string      $format Optional. Format to use for retrieving the time the post
    2842  *                            was written. Accepts 'G', 'U', or PHP date format.
    2843  *                            Defaults to the 'time_format' option.
    2844  * @param int|WP_Post $post   Post ID or post object. Default is global `$post` object.
     2841 * @param string           $format Optional. Format to use for retrieving the time the post
     2842 *                                 was written. Accepts 'G', 'U', or PHP date format.
     2843 *                                 Defaults to the 'time_format' option.
     2844 * @param int|WP_Post|null $post   Post ID or post object. Default is global `$post` object.
    28452845 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
    28462846 *                          False on failure.
     
    28752875 * @since 2.0.0
    28762876 *
    2877  * @param string      $format    Optional. Format to use for retrieving the time the post
    2878  *                               was written. Accepts 'G', 'U', or PHP date format. Default 'U'.
    2879  * @param bool        $gmt       Optional. Whether to retrieve the GMT time. Default false.
    2880  * @param int|WP_Post $post      Post ID or post object. Default is global `$post` object.
    2881  * @param bool        $translate Whether to translate the time string. Default false.
     2877 * @param string           $format    Optional. Format to use for retrieving the time the post
     2878 *                                    was written. Accepts 'G', 'U', or PHP date format. Default 'U'.
     2879 * @param bool             $gmt       Optional. Whether to retrieve the GMT time. Default false.
     2880 * @param int|WP_Post|null $post      Post ID or post object. Default is global `$post` object.
     2881 * @param bool             $translate Whether to translate the time string. Default false.
    28822882 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
    28832883 *                          False on failure.
     
    29392939 * @since 5.3.0
    29402940 *
    2941  * @param int|WP_Post $post   Optional. Post ID or post object. Default is global `$post` object.
    2942  * @param string      $field  Optional. Published or modified time to use from database. Accepts 'date' or 'modified'.
    2943  *                            Default 'date'.
    2944  * @param string      $source Optional. Local or UTC time to use from database. Accepts 'local' or 'gmt'.
    2945  *                            Default 'local'.
     2941 * @param int|WP_Post|null $post   Optional. Post ID or post object. Default is global `$post` object.
     2942 * @param string           $field  Optional. Published or modified time to use from database. Accepts 'date' or 'modified'.
     2943 *                                 Default 'date'.
     2944 * @param string           $source Optional. Local or UTC time to use from database. Accepts 'local' or 'gmt'.
     2945 *                                 Default 'local'.
    29462946 * @return DateTimeImmutable|false Time object on success, false on failure.
    29472947 */
     
    29842984 * @since 5.3.0
    29852985 *
    2986  * @param int|WP_Post $post  Optional. Post ID or post object. Default is global `$post` object.
    2987  * @param string      $field Optional. Published or modified time to use from database. Accepts 'date' or 'modified'.
    2988  *                           Default 'date'.
     2986 * @param int|WP_Post|null $post  Optional. Post ID or post object. Default is global `$post` object.
     2987 * @param string           $field Optional. Published or modified time to use from database. Accepts 'date' or 'modified'.
     2988 *                                Default 'date'.
    29892989 * @return int|false Unix timestamp on success, false on failure.
    29902990 */
     
    30273027 * @since 4.6.0 Added the `$post` parameter.
    30283028 *
    3029  * @param string      $format Optional. Format to use for retrieving the time the post
    3030  *                            was modified. Accepts 'G', 'U', or PHP date format.
    3031  *                            Defaults to the 'time_format' option.
    3032  * @param int|WP_Post $post   Optional. Post ID or WP_Post object. Default current post.
     3029 * @param string           $format Optional. Format to use for retrieving the time the post
     3030 *                                 was modified. Accepts 'G', 'U', or PHP date format.
     3031 *                                 Defaults to the 'time_format' option.
     3032 * @param int|WP_Post|null $post   Optional. Post ID or WP_Post object. Default current post.
    30333033 * @return string|int|false Formatted date string or Unix timestamp. False on failure.
    30343034 */
     
    30643064 * @since 2.0.0
    30653065 *
    3066  * @param string      $format    Optional. Format to use for retrieving the time the post
    3067  *                               was modified. Accepts 'G', 'U', or PHP date format. Default 'U'.
    3068  * @param bool        $gmt       Optional. Whether to retrieve the GMT time. Default false.
    3069  * @param int|WP_Post $post      Post ID or post object. Default is global `$post` object.
    3070  * @param bool        $translate Whether to translate the time string. Default false.
     3066 * @param string           $format    Optional. Format to use for retrieving the time the post
     3067 *                                    was modified. Accepts 'G', 'U', or PHP date format. Default 'U'.
     3068 * @param bool             $gmt       Optional. Whether to retrieve the GMT time. Default false.
     3069 * @param int|WP_Post|null $post      Post ID or post object. Default is global `$post` object.
     3070 * @param bool             $translate Whether to translate the time string. Default false.
    30713071 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
    30723072 *                          False on failure.
  • trunk/src/wp-includes/link-template.php

    r61637 r61649  
    9595 * @since 5.7.0
    9696 *
    97  * @param WP_Post|int|null $post   Optional. Post ID or post object. Defaults to global $post.
     97 * @param int|WP_Post|null $post   Optional. Post ID or post object. Defaults to global $post.
    9898 * @param bool|null        $sample Optional. Whether to force consideration based on sample links.
    9999 *                                 If omitted, a sample link is generated if a post object is passed
  • trunk/src/wp-includes/ms-blogs.php

    r59688 r61649  
    905905 * @since 4.9.0 Added the `$post` parameter.
    906906 *
    907  * @param string  $new_status The status the post is changing to.
    908  * @param string  $old_status The status the post is changing from.
    909  * @param WP_Post $post       Post object
     907 * @param string       $new_status The status the post is changing to.
     908 * @param string       $old_status The status the post is changing from.
     909 * @param WP_Post|null $post       Post object.
    910910 */
    911911function _update_posts_count_on_transition_post_status( $new_status, $old_status, $post = null ) {
  • trunk/src/wp-includes/post-template.php

    r61445 r61649  
    408408 * @since 4.5.0 Introduced the `$post` parameter.
    409409 *
    410  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
     410 * @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global $post.
    411411 * @return string Post excerpt.
    412412 */
     
    459459 * @since 2.7.0
    460460 *
    461  * @param string|string[] $css_class Optional. One or more classes to add to the class list.
    462  *                                   Default empty.
    463  * @param int|WP_Post    $post      Optional. Post ID or post object. Defaults to the global `$post`.
     461 * @param string|string[]  $css_class Optional. One or more classes to add to the class list.
     462 *                                    Default empty.
     463 * @param int|WP_Post|null $post      Optional. Post ID or post object. Defaults to the global `$post`.
    464464 */
    465465function post_class( $css_class = '', $post = null ) {
     
    487487 * @since 4.2.0 Custom taxonomy class names were added.
    488488 *
    489  * @param string|string[] $css_class Optional. Space-separated string or array of class names
    490  *                                   to add to the class list. Default empty.
    491  * @param int|WP_Post    $post      Optional. Post ID or post object.
     489 * @param string|string[]  $css_class Optional. Space-separated string or array of class names
     490 *                                    to add to the class list. Default empty.
     491 * @param int|WP_Post|null $post      Optional. Post ID or post object.
    492492 * @return string[] Array of class names.
    493493 */
     
    18841884 * @since 4.7.0 Now works with any post type, not just pages.
    18851885 *
    1886  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
     1886 * @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global $post.
    18871887 * @return string|false Page template filename. Returns an empty string when the default page template
    18881888 *                      is in use. Returns false if the post does not exist.
  • trunk/src/wp-includes/post.php

    r61634 r61649  
    12241224 * @since 2.0.0
    12251225 *
    1226  * @param int|WP_Post $post Optional. Post ID or post object. Defaults to global $post.
     1226 * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
    12271227 * @return string|false The mime type on success, false on failure.
    12281228 */
  • trunk/src/wp-includes/widgets/class-wp-widget-media.php

    r56549 r61649  
    361361     * @since 4.8.0
    362362     *
    363      * @param array   $states An array of media states.
    364      * @param WP_Post $post   The current attachment object.
     363     * @param array        $states An array of media states.
     364     * @param WP_Post|null $post   The current attachment object.
    365365     * @return array
    366366     */
Note: See TracChangeset for help on using the changeset viewer.