Skip to content

Commit 13be62e

Browse files
committed
CSS selector reformat ternaries
1 parent 67f7401 commit 13be62e

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

src/wp-includes/html-api/class-wp-css-selectors.php

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,9 @@ protected static function consume_escaped_codepoint( $input, &$offset ): ?string
390390
0 === $codepoint_value ||
391391
$codepoint_value > self::UTF8_MAX_CODEPOINT_VALUE ||
392392
( 0xD800 <= $codepoint_value && $codepoint_value <= 0xDFFF )
393-
) ?
394-
"\u{FFFD}" :
395-
mb_chr( $codepoint_value, 'UTF-8' );
393+
)
394+
? "\u{FFFD}"
395+
: mb_chr( $codepoint_value, 'UTF-8' );
396396

397397
$offset += $hex_length;
398398

@@ -582,9 +582,9 @@ public static function parse( string $input, int &$offset ): ?self {
582582

583583
public function matches( WP_HTML_Processor $processor ): bool {
584584
$case_insensitive = method_exists( $processor, 'is_quirks_mode' ) && $processor->is_quirks_mode();
585-
return $case_insensitive ?
586-
0 === strcasecmp( $processor->get_attribute( 'id' ), $this->ident ) :
587-
$processor->get_attribute( 'id' ) === $this->ident;
585+
return $case_insensitive
586+
? 0 === strcasecmp( $processor->get_attribute( 'id' ), $this->ident )
587+
: $processor->get_attribute( 'id' ) === $this->ident;
588588
}
589589
}
590590

@@ -693,9 +693,9 @@ public function matches( WP_HTML_Processor $processor ): bool {
693693

694694
switch ( $this->matcher ) {
695695
case self::MATCH_EXACT:
696-
return $case_insensitive ?
697-
0 === strcasecmp( $att_value, $this->value ) :
698-
$att_value === $this->value;
696+
return $case_insensitive
697+
? 0 === strcasecmp( $att_value, $this->value )
698+
: $att_value === $this->value;
699699

700700
case self::MATCH_ONE_OF_EXACT:
701701
// @todo
@@ -704,9 +704,9 @@ public function matches( WP_HTML_Processor $processor ): bool {
704704
case self::MATCH_EXACT_OR_EXACT_WITH_HYPHEN:
705705
// Attempt the full match first
706706
if (
707-
$case_insensitive ?
708-
0 === strcasecmp( $att_value, $this->value ) :
709-
$att_value === $this->value
707+
$case_insensitive
708+
? 0 === strcasecmp( $att_value, $this->value )
709+
: $att_value === $this->value
710710
) {
711711
return true;
712712
}
@@ -1017,13 +1017,16 @@ private static function parse_subclass_selector( string $input, int &$offset ) {
10171017
}
10181018

10191019
$next_char = $input[ $offset ];
1020-
return '.' === $next_char ?
1021-
WP_CSS_Class_Selector::parse( $input, $offset ) : (
1022-
'#' === $next_char ?
1023-
WP_CSS_ID_Selector::parse( $input, $offset ) : (
1024-
'[' === $next_char ?
1025-
WP_CSS_Attribute_Selector::parse( $input, $offset ) :
1026-
null ) );
1020+
return '.' === $next_char
1021+
? WP_CSS_Class_Selector::parse( $input, $offset )
1022+
: (
1023+
'#' === $next_char
1024+
? WP_CSS_ID_Selector::parse( $input, $offset )
1025+
: ( '[' === $next_char
1026+
? WP_CSS_Attribute_Selector::parse( $input, $offset )
1027+
: null
1028+
)
1029+
);
10271030
}
10281031
}
10291032

0 commit comments

Comments
 (0)