Skip to content

Commit 0d33b5c

Browse files
committed
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 #8953 Props justlevine, westonruter. See #64238, #64224. git-svn-id: https://develop.svn.wordpress.org/trunk@61299 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 2cf0f3d commit 0d33b5c

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

src/wp-includes/class-wp-dependencies.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class WP_Dependencies {
9191
*
9292
* @since 5.4.0
9393
*
94-
* @var array
94+
* @var ?array<string, true>
9595
*/
9696
private $all_queued_deps;
9797

src/wp-includes/class-wp-duotone.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class WP_Duotone {
5252
*
5353
* @since 6.3.0
5454
*
55-
* @var array
55+
* @var ?array
5656
*/
5757
private static $global_styles_block_names;
5858

@@ -76,7 +76,7 @@ class WP_Duotone {
7676
*
7777
* @since 6.3.0
7878
*
79-
* @var array
79+
* @var ?array
8080
*/
8181
private static $global_styles_presets;
8282

src/wp-includes/class-wp-query.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class WP_Query {
2222
* Query vars set by the user.
2323
*
2424
* @since 1.5.0
25-
* @var array
25+
* @var ?array
2626
*/
2727
public $query;
2828

@@ -72,23 +72,23 @@ class WP_Query {
7272
* The ID of the queried object.
7373
*
7474
* @since 1.5.0
75-
* @var int
75+
* @var ?int
7676
*/
7777
public $queried_object_id;
7878

7979
/**
8080
* SQL for the database query.
8181
*
8282
* @since 2.0.1
83-
* @var string
83+
* @var ?string
8484
*/
8585
public $request;
8686

8787
/**
8888
* Array of post objects or post IDs.
8989
*
9090
* @since 1.5.0
91-
* @var WP_Post[]|int[]
91+
* @var WP_Post[]|int[]|null
9292
*/
9393
public $posts;
9494

@@ -139,7 +139,7 @@ class WP_Query {
139139
* The list of comments for current post.
140140
*
141141
* @since 2.2.0
142-
* @var WP_Comment[]
142+
* @var ?WP_Comment[]
143143
*/
144144
public $comments;
145145

@@ -163,7 +163,7 @@ class WP_Query {
163163
* Current comment object.
164164
*
165165
* @since 2.2.0
166-
* @var WP_Comment
166+
* @var ?WP_Comment
167167
*/
168168
public $comment;
169169

@@ -466,7 +466,7 @@ class WP_Query {
466466
* Cached list of search stopwords.
467467
*
468468
* @since 3.7.0
469-
* @var array
469+
* @var ?array
470470
*/
471471
private $stopwords;
472472

src/wp-includes/class-wp-rewrite.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,23 @@ class WP_Rewrite {
5252
* Permalink structure for author archives.
5353
*
5454
* @since 1.5.0
55-
* @var string
55+
* @var ?string
5656
*/
5757
public $author_structure;
5858

5959
/**
6060
* Permalink structure for date archives.
6161
*
6262
* @since 1.5.0
63-
* @var string
63+
* @var ?string
6464
*/
6565
public $date_structure;
6666

6767
/**
6868
* Permalink structure for pages.
6969
*
7070
* @since 1.5.0
71-
* @var string
71+
* @var ?string
7272
*/
7373
public $page_structure;
7474

@@ -84,7 +84,7 @@ class WP_Rewrite {
8484
* Permalink structure for searches.
8585
*
8686
* @since 1.5.0
87-
* @var string
87+
* @var ?string
8888
*/
8989
public $search_structure;
9090

@@ -124,15 +124,15 @@ class WP_Rewrite {
124124
* Comments feed permalink structure.
125125
*
126126
* @since 1.5.0
127-
* @var string
127+
* @var ?string
128128
*/
129129
public $comment_feed_structure;
130130

131131
/**
132132
* Feed request permalink structure.
133133
*
134134
* @since 1.5.0
135-
* @var string
135+
* @var ?string
136136
*/
137137
public $feed_structure;
138138

src/wp-includes/class-wp-theme.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ final class WP_Theme implements ArrayAccess {
114114
* Header data from the theme's style.css file after being sanitized.
115115
*
116116
* @since 3.4.0
117-
* @var array
117+
* @var ?array
118118
*/
119119
private $headers_sanitized;
120120

121121
/**
122122
* Is this theme a block theme.
123123
*
124124
* @since 6.2.0
125-
* @var bool
125+
* @var ?bool
126126
*/
127127
private $block_theme;
128128

@@ -132,15 +132,15 @@ final class WP_Theme implements ArrayAccess {
132132
* Cached due to sorting functions running over the translated name.
133133
*
134134
* @since 3.4.0
135-
* @var string
135+
* @var ?string
136136
*/
137137
private $name_translated;
138138

139139
/**
140140
* Errors encountered when initializing the theme.
141141
*
142142
* @since 3.4.0
143-
* @var WP_Error
143+
* @var ?WP_Error
144144
*/
145145
private $errors;
146146

@@ -162,31 +162,31 @@ final class WP_Theme implements ArrayAccess {
162162
* Otherwise, 'template' is the same as 'stylesheet'.
163163
*
164164
* @since 3.4.0
165-
* @var string
165+
* @var ?string
166166
*/
167167
private $template;
168168

169169
/**
170170
* A reference to the parent theme, in the case of a child theme.
171171
*
172172
* @since 3.4.0
173-
* @var WP_Theme
173+
* @var ?WP_Theme
174174
*/
175175
private $parent;
176176

177177
/**
178178
* URL to the theme root, usually an absolute URL to wp-content/themes
179179
*
180180
* @since 3.4.0
181-
* @var string
181+
* @var ?string
182182
*/
183183
private $theme_root_uri;
184184

185185
/**
186186
* Flag for whether the theme's textdomain is loaded.
187187
*
188188
* @since 3.4.0
189-
* @var bool
189+
* @var ?bool
190190
*/
191191
private $textdomain_loaded;
192192

@@ -202,7 +202,7 @@ final class WP_Theme implements ArrayAccess {
202202
* Block template folders.
203203
*
204204
* @since 6.4.0
205-
* @var string[]
205+
* @var ?string[]
206206
*/
207207
private $block_template_folders;
208208

0 commit comments

Comments
 (0)