Make WordPress Core


Ignore:
Timestamp:
11/25/2025 01:58:14 AM (7 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-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;
Note: See TracChangeset for help on using the changeset viewer.