Repository navigation
Commit 29fdba3
HTML API: Type tag queries and tag names for PHPStan.
The `$query` parameter of `next_tag()` is documented as `array|string|null`, but its hash notation only describes the array form, so stubs generated from it (as used by Gutenberg) turned it into an array shape and dropped the bare tag-name form, reporting calls like `next_tag( 'FIGURE' )` as errors. A `Query` type alias now covers the array, bare tag-name, and `null` forms, with each key allowed to be `null` as documented. The HTML Processor defines its own alias adding the `breadcrumbs` key, since type aliases are not inherited by subclasses.
Tag names are returned as `non-falsy-string`, since a parsed name is never empty or `'0'`, but accepted as `non-empty-string`, since that is all a `'' !== $tag` check proves and a `'0'` query simply matches nothing.
The changes are to PHPDoc only, so there is no runtime change.
Developed in WordPress#15305.
Follow-up to r55203.
Props westonruter, dmsnell.
See #65817.
git-svn-id: https://develop.svn.wordpress.org/trunk@65220 602fd350-edb4-49c9-b593-d223f7449a821 parent fd40e02 commit 29fdba3
3 files changed
Lines changed: 52 additions & 1 deletion
File tree
- src/wp-includes/html-api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
146 | 154 | | |
147 | 155 | | |
148 | 156 | | |
| |||
237 | 245 | | |
238 | 246 | | |
239 | 247 | | |
| 248 | + | |
240 | 249 | | |
241 | 250 | | |
242 | 251 | | |
| |||
687 | 696 | | |
688 | 697 | | |
689 | 698 | | |
| 699 | + | |
| 700 | + | |
690 | 701 | | |
691 | 702 | | |
692 | 703 | | |
| |||
930 | 941 | | |
931 | 942 | | |
932 | 943 | | |
| 944 | + | |
| 945 | + | |
933 | 946 | | |
934 | 947 | | |
935 | 948 | | |
| |||
1201 | 1214 | | |
1202 | 1215 | | |
1203 | 1216 | | |
| 1217 | + | |
| 1218 | + | |
1204 | 1219 | | |
1205 | 1220 | | |
1206 | 1221 | | |
| |||
5154 | 5169 | | |
5155 | 5170 | | |
5156 | 5171 | | |
| 5172 | + | |
| 5173 | + | |
5157 | 5174 | | |
5158 | 5175 | | |
5159 | 5176 | | |
| |||
5219 | 5236 | | |
5220 | 5237 | | |
5221 | 5238 | | |
| 5239 | + | |
| 5240 | + | |
5222 | 5241 | | |
5223 | 5242 | | |
5224 | 5243 | | |
| |||
6276 | 6295 | | |
6277 | 6296 | | |
6278 | 6297 | | |
| 6298 | + | |
| 6299 | + | |
6279 | 6300 | | |
6280 | 6301 | | |
6281 | 6302 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
410 | 417 | | |
411 | 418 | | |
412 | 419 | | |
| |||
443 | 450 | | |
444 | 451 | | |
445 | 452 | | |
446 | | - | |
| 453 | + | |
| 454 | + | |
447 | 455 | | |
448 | 456 | | |
449 | 457 | | |
| |||
452 | 460 | | |
453 | 461 | | |
454 | 462 | | |
| 463 | + | |
455 | 464 | | |
456 | 465 | | |
457 | 466 | | |
| |||
460 | 469 | | |
461 | 470 | | |
462 | 471 | | |
| 472 | + | |
463 | 473 | | |
464 | 474 | | |
465 | 475 | | |
| |||
468 | 478 | | |
469 | 479 | | |
470 | 480 | | |
| 481 | + | |
471 | 482 | | |
472 | 483 | | |
473 | 484 | | |
| |||
895 | 906 | | |
896 | 907 | | |
897 | 908 | | |
| 909 | + | |
898 | 910 | | |
899 | 911 | | |
900 | 912 | | |
| |||
3034 | 3046 | | |
3035 | 3047 | | |
3036 | 3048 | | |
| 3049 | + | |
| 3050 | + | |
3037 | 3051 | | |
3038 | 3052 | | |
3039 | 3053 | | |
3040 | 3054 | | |
3041 | 3055 | | |
3042 | 3056 | | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
3043 | 3065 | | |
3044 | 3066 | | |
3045 | 3067 | | |
| |||
3071 | 3093 | | |
3072 | 3094 | | |
3073 | 3095 | | |
| 3096 | + | |
| 3097 | + | |
3074 | 3098 | | |
3075 | 3099 | | |
3076 | 3100 | | |
| |||
3569 | 3593 | | |
3570 | 3594 | | |
3571 | 3595 | | |
| 3596 | + | |
| 3597 | + | |
3572 | 3598 | | |
3573 | 3599 | | |
3574 | 3600 | | |
| |||
4988 | 5014 | | |
4989 | 5015 | | |
4990 | 5016 | | |
| 5017 | + | |
4991 | 5018 | | |
4992 | 5019 | | |
4993 | 5020 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| 100 | + | |
| 101 | + | |
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| |||
0 commit comments