Make WordPress Core

Changeset 61299


Ignore:
Timestamp:
11/25/2025 01:58:14 AM (3 months ago)
Author:
westonruter
Message:

Docs: Update various class @var tags to indicate nullability.

This updates various @var tags on class properties to correctly indicate that the props may be null or unset:

  • WP_Dependencies::$all_queued_deps is nullable by both ::enqueue() and ::dequeue. Also, the types of the keys and values are specified.
  • WP_Duotone::$global_styles_presets and ::$global_styles_block_names start off unset and are only initialized by static classes.
  • WP_Query::init() and WP_Rewrite::init() are public methods that unset()s many class props.
  • WP_Theme::cache_delete() sets many props to null.

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

Props justlevine, westonruter.
See #64238, #64224.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-dependencies.php

    r60948 r61299  
    9292     * @since 5.4.0
    9393     *
    94      * @var array
     94     * @var ?array<string, true>
    9595     */
    9696    private $all_queued_deps;
  • trunk/src/wp-includes/class-wp-duotone.php

    r61247 r61299  
    5353     * @since 6.3.0
    5454     *
    55      * @var array
     55     * @var ?array
    5656     */
    5757    private static $global_styles_block_names;
     
    7777     * @since 6.3.0
    7878     *
    79      * @var array
     79     * @var ?array
    8080     */
    8181    private static $global_styles_presets;
  • trunk/src/wp-includes/class-wp-query.php

    r61044 r61299  
    2323     *
    2424     * @since 1.5.0
    25      * @var array
     25     * @var ?array
    2626     */
    2727    public $query;
     
    7373     *
    7474     * @since 1.5.0
    75      * @var int
     75     * @var ?int
    7676     */
    7777    public $queried_object_id;
     
    8181     *
    8282     * @since 2.0.1
    83      * @var string
     83     * @var ?string
    8484     */
    8585    public $request;
     
    8989     *
    9090     * @since 1.5.0
    91      * @var WP_Post[]|int[]
     91     * @var WP_Post[]|int[]|null
    9292     */
    9393    public $posts;
     
    140140     *
    141141     * @since 2.2.0
    142      * @var WP_Comment[]
     142     * @var ?WP_Comment[]
    143143     */
    144144    public $comments;
     
    164164     *
    165165     * @since 2.2.0
    166      * @var WP_Comment
     166     * @var ?WP_Comment
    167167     */
    168168    public $comment;
     
    467467     *
    468468     * @since 3.7.0
    469      * @var array
     469     * @var ?array
    470470     */
    471471    private $stopwords;
  • trunk/src/wp-includes/class-wp-rewrite.php

    r60458 r61299  
    5353     *
    5454     * @since 1.5.0
     55     * @var ?string
     56     */
     57    public $author_structure;
     58
     59    /**
     60     * Permalink structure for date archives.
     61     *
     62     * @since 1.5.0
     63     * @var ?string
     64     */
     65    public $date_structure;
     66
     67    /**
     68     * Permalink structure for pages.
     69     *
     70     * @since 1.5.0
     71     * @var ?string
     72     */
     73    public $page_structure;
     74
     75    /**
     76     * Base of the search permalink structure (example.com/$search_base/query).
     77     *
     78     * @since 1.5.0
    5579     * @var string
    5680     */
    57     public $author_structure;
    58 
    59     /**
    60      * Permalink structure for date archives.
    61      *
    62      * @since 1.5.0
    63      * @var string
    64      */
    65     public $date_structure;
    66 
    67     /**
    68      * Permalink structure for pages.
    69      *
    70      * @since 1.5.0
    71      * @var string
    72      */
    73     public $page_structure;
    74 
    75     /**
    76      * Base of the search permalink structure (example.com/$search_base/query).
    77      *
    78      * @since 1.5.0
    79      * @var string
    80      */
    8181    public $search_base = 'search';
    8282
     
    8585     *
    8686     * @since 1.5.0
    87      * @var string
     87     * @var ?string
    8888     */
    8989    public $search_structure;
     
    125125     *
    126126     * @since 1.5.0
    127      * @var string
     127     * @var ?string
    128128     */
    129129    public $comment_feed_structure;
     
    133133     *
    134134     * @since 1.5.0
    135      * @var string
     135     * @var ?string
    136136     */
    137137    public $feed_structure;
  • trunk/src/wp-includes/class-wp-theme.php

    r60804 r61299  
    115115     *
    116116     * @since 3.4.0
    117      * @var array
     117     * @var ?array
    118118     */
    119119    private $headers_sanitized;
     
    123123     *
    124124     * @since 6.2.0
    125      * @var bool
     125     * @var ?bool
    126126     */
    127127    private $block_theme;
     
    133133     *
    134134     * @since 3.4.0
    135      * @var string
     135     * @var ?string
    136136     */
    137137    private $name_translated;
     
    141141     *
    142142     * @since 3.4.0
    143      * @var WP_Error
     143     * @var ?WP_Error
    144144     */
    145145    private $errors;
     
    163163     *
    164164     * @since 3.4.0
     165     * @var ?string
     166     */
     167    private $template;
     168
     169    /**
     170     * A reference to the parent theme, in the case of a child theme.
     171     *
     172     * @since 3.4.0
     173     * @var ?WP_Theme
     174     */
     175    private $parent;
     176
     177    /**
     178     * URL to the theme root, usually an absolute URL to wp-content/themes
     179     *
     180     * @since 3.4.0
     181     * @var ?string
     182     */
     183    private $theme_root_uri;
     184
     185    /**
     186     * Flag for whether the theme's textdomain is loaded.
     187     *
     188     * @since 3.4.0
     189     * @var ?bool
     190     */
     191    private $textdomain_loaded;
     192
     193    /**
     194     * Stores an md5 hash of the theme root, to function as the cache key.
     195     *
     196     * @since 3.4.0
    165197     * @var string
    166198     */
    167     private $template;
    168 
    169     /**
    170      * A reference to the parent theme, in the case of a child theme.
    171      *
    172      * @since 3.4.0
    173      * @var WP_Theme
    174      */
    175     private $parent;
    176 
    177     /**
    178      * URL to the theme root, usually an absolute URL to wp-content/themes
    179      *
    180      * @since 3.4.0
    181      * @var string
    182      */
    183     private $theme_root_uri;
    184 
    185     /**
    186      * Flag for whether the theme's textdomain is loaded.
    187      *
    188      * @since 3.4.0
    189      * @var bool
    190      */
    191     private $textdomain_loaded;
    192 
    193     /**
    194      * Stores an md5 hash of the theme root, to function as the cache key.
    195      *
    196      * @since 3.4.0
    197      * @var string
    198      */
    199199    private $cache_hash;
    200200
     
    203203     *
    204204     * @since 6.4.0
    205      * @var string[]
     205     * @var ?string[]
    206206     */
    207207    private $block_template_folders;
Note: See TracChangeset for help on using the changeset viewer.