From 09971970d880ec5490de0c9ffca1b418bbefeadb Mon Sep 17 00:00:00 2001 From: Jake Hotson Date: Wed, 16 Jul 2025 00:26:29 +0100 Subject: [PATCH] [CLEANUP] Avoid use of short-ternary operator (I share a birthday with Elvis, but needs must.) --- config/phpstan-baseline.neon | 6 ------ src/CSSList/CSSList.php | 7 +++++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/config/phpstan-baseline.neon b/config/phpstan-baseline.neon index e96a6ae21..587fcb0ed 100644 --- a/config/phpstan-baseline.neon +++ b/config/phpstan-baseline.neon @@ -18,12 +18,6 @@ parameters: count: 1 path: ../src/CSSList/CSSList.php - - - message: '#^Short ternary operator is not allowed\. Use null coalesce operator if applicable or consider using long ternary\.$#' - identifier: ternary.shortNotAllowed - count: 1 - path: ../src/CSSList/CSSList.php - - message: '#^Parameters should have "string\|null" types as the only types passed to this method$#' identifier: typePerfect.narrowPublicClassMethodParamType diff --git a/src/CSSList/CSSList.php b/src/CSSList/CSSList.php index 826581a2f..8cbf74e09 100644 --- a/src/CSSList/CSSList.php +++ b/src/CSSList/CSSList.php @@ -242,8 +242,11 @@ private static function parseAtRule(ParserState $parserState): ?CSSListItem */ private static function identifierIs(string $identifier, string $match): bool { - return (\strcasecmp($identifier, $match) === 0) - ?: \preg_match("/^(-\\w+-)?$match$/i", $identifier) === 1; + if (\strcasecmp($identifier, $match) === 0) { + return true; + } + + return \preg_match("/^(-\\w+-)?$match$/i", $identifier) === 1; } /**