diff --git a/CHANGELOG.md b/CHANGELOG.md index 83705952..7052cd6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ Please also have a look at our ### Fixed +- Use typesafe versions of PHP functions (#1379) + ### Documentation ## 9.1.0: Add support for PHP 8.5 diff --git a/src/Value/Value.php b/src/Value/Value.php index 9f4fe1e6..263c420d 100644 --- a/src/Value/Value.php +++ b/src/Value/Value.php @@ -12,6 +12,8 @@ use Sabberworm\CSS\Position\Position; use Sabberworm\CSS\Position\Positionable; +use function Safe\preg_match; + /** * Abstract base class for specific classes of CSS values: `Size`, `Color`, `CSSString` and `URL`, and another * abstract subclass `ValueList`. @@ -204,7 +206,9 @@ private static function parseUnicodeRangeValue(ParserState $parserState): string $codepointMaxLength = 13; // Max length is 2 six-digit code points + the dash(-) between them } $range .= $parserState->consume(1); - } while (\strlen($range) < $codepointMaxLength && \preg_match('/[A-Fa-f0-9\\?-]/', $parserState->peek())); + } while ( + (\strlen($range) < $codepointMaxLength) && (preg_match('/[A-Fa-f0-9\\?-]/', $parserState->peek()) === 1) + ); return "U+{$range}"; }