From 6ccf8b9a331e4345dfdb18aabad7d69b577e1d0a Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Mon, 20 Jul 2026 19:44:55 +0200 Subject: [PATCH] Update WP_HTML_Processor::class_list example to runnable snippet --- .../html-api/class-wp-html-processor.php | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 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 b2a597b938495..401b322446fae 100644 --- a/src/wp-includes/html-api/class-wp-html-processor.php +++ b/src/wp-includes/html-api/class-wp-html-processor.php @@ -5431,14 +5431,30 @@ public function has_class( $wanted_class ): ?bool { * * This generator function is designed to be used inside a "foreach" loop. * - * Example: - * - * $p = WP_HTML_Processor::create_fragment( "
" ); - * $p->next_tag(); - * foreach ( $p->class_list() as $class_name ) { - * echo "{$class_name} "; - * } - * // Outputs: "free lang-en " + * ```php + * " ); + * $p->next_tag(); + * foreach ( $p->class_list() as $class_name ) { + * var_dump( $class_name ); + * } + * ``` + * ```expected-output + * string(4) "free" + * string(5) "" + * string(7) "lang-en" + * ``` * * @since 6.6.0 Subclassed for the HTML Processor. */