Skip to content

Commit 6039270

Browse files
authored
[CLEANUP] Avoid use of short-ternary operator (#1336)
(I share a birthday with Elvis, but needs must.)
1 parent e57a7ba commit 6039270

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

config/phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ parameters:
1818
count: 1
1919
path: ../src/CSSList/CSSList.php
2020

21-
-
22-
message: '#^Short ternary operator is not allowed\. Use null coalesce operator if applicable or consider using long ternary\.$#'
23-
identifier: ternary.shortNotAllowed
24-
count: 1
25-
path: ../src/CSSList/CSSList.php
26-
2721
-
2822
message: '#^Parameters should have "string\|null" types as the only types passed to this method$#'
2923
identifier: typePerfect.narrowPublicClassMethodParamType

src/CSSList/CSSList.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,11 @@ private static function parseAtRule(ParserState $parserState): ?CSSListItem
242242
*/
243243
private static function identifierIs(string $identifier, string $match): bool
244244
{
245-
return (\strcasecmp($identifier, $match) === 0)
246-
?: \preg_match("/^(-\\w+-)?$match$/i", $identifier) === 1;
245+
if (\strcasecmp($identifier, $match) === 0) {
246+
return true;
247+
}
248+
249+
return \preg_match("/^(-\\w+-)?$match$/i", $identifier) === 1;
247250
}
248251

249252
/**

0 commit comments

Comments
 (0)