Make WordPress Core


Ignore:
Timestamp:
11/25/2025 01:58:14 AM (11 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.