From 2b49715077de18a798453d73a1d1edc8280fd980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=83=C2=B3=C3=85=E2=80=9Akowski?= Date: Tue, 10 Dec 2024 11:39:06 +0000 Subject: [PATCH] HTML API: Remove nullable from get_breadcrumbs return type Follow-up [58713] Props jonsurrell, westonruter, gziolo. Fixes #62674. git-svn-id: https://develop.svn.wordpress.org/trunk@59503 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/html-api/class-wp-html-processor.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/wp-includes/html-api/class-wp-html-processor.php b/src/wp-includes/html-api/class-wp-html-processor.php index 8d2a476769efe..2bc38b305a9f2 100644 --- a/src/wp-includes/html-api/class-wp-html-processor.php +++ b/src/wp-includes/html-api/class-wp-html-processor.php @@ -1143,11 +1143,7 @@ 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( '

' ); * $processor->next_tag( 'IMG' ); @@ -1155,9 +1151,9 @@ public function step( $node_to_process = self::PROCESS_NEXT_NODE ): bool { * * @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; }