Skip to content

Commit

Permalink
HTML API: Remove nullable from get_breadcrumbs return type
Browse files Browse the repository at this point in the history
Follow-up [58713]
Props jonsurrell, westonruter, gziolo.
Fixes #62674.



git-svn-id: https://develop.svn.wordpress.org/trunk@59503 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
gziolo committed Dec 10, 2024
1 parent 1467750 commit 2b49715
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/wp-includes/html-api/class-wp-html-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1143,21 +1143,17 @@ public function step( $node_to_process = self::PROCESS_NEXT_NODE ): bool {
* Breadcrumbs start at the outermost parent and descend toward the matched element.
* They always include the entire path from the root HTML node to the matched element.
*
* @todo It could be more efficient to expose a generator-based version of this function
* to avoid creating the array copy on tag iteration. If this is done, it would likely
* be more useful to walk up the stack when yielding instead of starting at the top.
*
* Example
* Example:
*
* $processor = WP_HTML_Processor::create_fragment( '<p><strong><em><img></em></strong></p>' );
* $processor->next_tag( 'IMG' );
* $processor->get_breadcrumbs() === array( 'HTML', 'BODY', 'P', 'STRONG', 'EM', 'IMG' );
*
* @since 6.4.0
*
* @return string[]|null Array of tag names representing path to matched node, if matched, otherwise NULL.
* @return string[] Array of tag names representing path to matched node.
*/
public function get_breadcrumbs(): ?array {
public function get_breadcrumbs(): array {
return $this->breadcrumbs;
}

Expand Down

0 comments on commit 2b49715

Please sign in to comment.