Skip to content

Commit 0e5fb75

Browse files
committed
HTML API: Remove redundant isset check in provenance computation
When is_virtual is false, current_token is guaranteed to be set (the is_virtual check already validates this). Remove the redundant isset() call from the provenance ternary in push/pop handlers.
1 parent 26a1b1c commit 0e5fb75

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/wp-includes/html-api/class-wp-html-processor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ public function __construct( $html, $use_the_static_create_methods_instead = nul
458458
function ( WP_HTML_Token $token ): void {
459459
$current_token = $this->state->current_token;
460460
$is_virtual = ! isset( $current_token ) || parent::is_tag_closer();
461-
$provenance = ( ! $is_virtual && isset( $current_token ) && $token->node_name === $current_token->node_name ) ? 'real' : 'virtual';
461+
$provenance = ( ! $is_virtual && $token->node_name === $current_token->node_name ) ? 'real' : 'virtual';
462462
$this->element_queue[] = new WP_HTML_Stack_Event( $token, WP_HTML_Stack_Event::PUSH, $provenance );
463463

464464
if ( $token->integration_node_type ) {
@@ -473,7 +473,7 @@ function ( WP_HTML_Token $token ): void {
473473
function ( WP_HTML_Token $token ): void {
474474
$current_token = $this->state->current_token;
475475
$is_virtual = ! isset( $current_token ) || ! parent::is_tag_closer();
476-
$provenance = ( ! $is_virtual && isset( $current_token ) && $token->node_name === $current_token->node_name ) ? 'real' : 'virtual';
476+
$provenance = ( ! $is_virtual && $token->node_name === $current_token->node_name ) ? 'real' : 'virtual';
477477
$this->element_queue[] = new WP_HTML_Stack_Event( $token, WP_HTML_Stack_Event::POP, $provenance );
478478

479479
$adjusted_current_node = $this->get_adjusted_current_node();

0 commit comments

Comments
 (0)