Changeset 65220
- Timestamp:
- 11/03/2026 05:58:23 AM (3 days ago)
- Location:
- trunk/src/wp-includes/html-api
- Files:
-
- 3 edited
-
class-wp-html-processor.php (modified) (8 diffs)
-
class-wp-html-tag-processor.php (modified) (11 diffs)
-
class-wp-html-token.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-processor.php
r64673 r65220 144 144 * @link https://html.spec.whatwg.org/ 145 145 * @phpstan-consistent-constructor 146 * 147 * @phpstan-type Query array{ 148 * tag_name?: non-empty-string|null, 149 * match_offset?: int<1, max>|null, 150 * class_name?: non-empty-string|null, 151 * tag_closers?: 'visit'|'skip'|null, 152 * breadcrumbs?: array<non-empty-string>, 153 * }|non-empty-string|null 146 154 */ 147 155 class WP_HTML_Processor extends WP_HTML_Tag_Processor { … … 238 246 * 239 247 * @var string[] 248 * @phpstan-var list<non-falsy-string> 240 249 */ 241 250 private $breadcrumbs = array(); … … 688 697 * } 689 698 * @return bool Whether a tag was matched. 699 * 700 * @phpstan-param Query $query 690 701 */ 691 702 public function next_tag( $query = null ): bool { … … 931 942 * May also contain the wildcard `*` which matches a single element, e.g. `array( 'SECTION', '*' )`. 932 943 * @return bool Whether the currently-matched tag is found at the given nested structure. 944 * 945 * @phpstan-param array<non-empty-string> $breadcrumbs 933 946 */ 934 947 public function matches_breadcrumbs( $breadcrumbs ): bool { … … 1202 1215 * 1203 1216 * @return string[] Array of tag names representing path to matched node. 1217 * 1218 * @phpstan-return list<non-falsy-string> 1204 1219 */ 1205 1220 public function get_breadcrumbs(): array { … … 5155 5170 * 5156 5171 * @return string|null Name of currently matched tag in input HTML, or `null` if none found. 5172 * 5173 * @phpstan-return non-falsy-string|null 5157 5174 */ 5158 5175 public function get_tag(): ?string { … … 5220 5237 * 5221 5238 * @return string|null Name of the matched token. 5239 * 5240 * @phpstan-return non-falsy-string|null 5222 5241 */ 5223 5242 public function get_token_name(): ?string { … … 6277 6296 * Defaults to auto-creating a bookmark name. 6278 6297 * @return WP_HTML_Token Newly-created virtual token. 6298 * 6299 * @phpstan-param non-falsy-string $token_name 6279 6300 */ 6280 6301 private function insert_virtual_node( $token_name, $bookmark_name = null ): WP_HTML_Token { -
trunk/src/wp-includes/html-api/class-wp-html-tag-processor.php
r64872 r65220 408 408 * Introduces "special" elements which act like void elements, e.g. TITLE, STYLE. 409 409 * Allows scanning through all tokens and processing modifiable text, where applicable. 410 * 411 * @phpstan-type Query array{ 412 * tag_name?: non-empty-string|null, 413 * match_offset?: int<1, max>|null, 414 * class_name?: non-empty-string|null, 415 * tag_closers?: 'visit'|'skip'|null, 416 * }|non-empty-string|null 410 417 */ 411 418 class WP_HTML_Tag_Processor { … … 444 451 * 445 452 * @since 6.2.0 446 * @var array|null 453 * @var array|string|null 454 * @phpstan-var Query 447 455 */ 448 456 private $last_query; … … 453 461 * @since 6.2.0 454 462 * @var string|null 463 * @phpstan-var non-empty-string|null 455 464 */ 456 465 private $sought_tag_name; … … 461 470 * @since 6.2.0 462 471 * @var string|null 472 * @phpstan-var non-empty-string|null 463 473 */ 464 474 private $sought_class_name; … … 469 479 * @since 6.2.0 470 480 * @var int|null 481 * @phpstan-var int<1, max>|null 471 482 */ 472 483 private $sought_match_offset; … … 896 907 * @return bool Whether a tag was matched. 897 908 * 909 * @phpstan-param Query $query 898 910 * @phpstan-impure 899 911 */ … … 3035 3047 * 3036 3048 * @return string|null Name of currently matched tag in input HTML, or `null` if none found. 3049 * 3050 * @phpstan-return non-falsy-string|null 3037 3051 */ 3038 3052 public function get_tag(): ?string { … … 3041 3055 } 3042 3056 3057 /** 3058 * The name is never empty and never "0": a tag name starts with an ASCII 3059 * letter, a processing instruction target with a letter or "_", and the 3060 * target of a comment which looks like a processing instruction with a 3061 * letter, ":", or "_". 3062 * 3063 * @var non-falsy-string $tag_name 3064 */ 3043 3065 $tag_name = str_replace( "\x00", "\u{FFFD}", substr( $this->html, $this->tag_name_starts_at, $this->tag_name_length ) ); 3044 3066 … … 3072 3094 * 3073 3095 * @return string|null Name of current tag name. 3096 * 3097 * @phpstan-return non-falsy-string|null 3074 3098 */ 3075 3099 public function get_qualified_tag_name(): ?string { … … 3570 3594 * 3571 3595 * @return string|null Name of the matched token. 3596 * 3597 * @phpstan-return non-falsy-string|null 3572 3598 */ 3573 3599 public function get_token_name(): ?string { … … 4989 5015 * @type string $tag_closers "visit" or "skip": whether to stop on tag closers, e.g. </div>. 4990 5016 * } 5017 * @phpstan-param Query $query 4991 5018 */ 4992 5019 private function parse_query( $query ) { -
trunk/src/wp-includes/html-api/class-wp-html-token.php
r64636 r65220 44 44 * 45 45 * @var string 46 * @phpstan-var non-falsy-string 46 47 */ 47 48 public $node_name = null; … … 97 98 * @param bool $has_self_closing_flag Whether the source token contains the self-closing flag, regardless of whether it's valid. 98 99 * @param callable|null $on_destroy Optional. Function to call when destroying token, useful for releasing the bookmark. 100 * 101 * @phpstan-param non-falsy-string $node_name 99 102 */ 100 103 public function __construct( ?string $bookmark_name, string $node_name, bool $has_self_closing_flag, ?callable $on_destroy = null ) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)