Skip to content

Commit 9aef2e5

Browse files
committed
Throw on unhandled token types
1 parent 5d0b918 commit 9aef2e5

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,6 @@ public static function build_html5_treelike_string( $fragment_context, $html ) {
183183
$output .= str_repeat( $indent, $indent_level ) . "\"{$processor->get_modifiable_text()}\"\n";
184184
break;
185185

186-
case '#cdata-section':
187-
break;
188-
189-
case '#processing-instruction':
190-
break;
191-
192186
case '#comment':
193187
switch ( $processor->get_comment_type() ) {
194188
case WP_HTML_Processor::COMMENT_AS_ABRUPTLY_CLOSED_COMMENT:
@@ -201,20 +195,14 @@ public static function build_html5_treelike_string( $fragment_context, $html ) {
201195
break;
202196

203197
default:
204-
throw new Exception( "Unhandled comment type for tree construction: {$processor->get_comment_type()}" );
198+
throw new Error( "Unhandled comment type for tree construction: {$processor->get_comment_type()}" );
205199
}
206200
// Comments must be "<" then "!-- " then the data then " -->".
207201
$output .= str_repeat( $indent, $indent_level ) . "<!-- {$commentTextContent} -->\n";
208202
break;
209203

210-
case '#doctype':
211-
break;
212-
213-
case '#presumptuous-tag':
214-
break;
215-
216-
case '#funky-comment':
217-
break;
204+
default:
205+
throw new Error( "Unhandled token type for tree construction: {$processor->get_token_type()}" );
218206
}
219207
}
220208

0 commit comments

Comments
 (0)