Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Build/phpstan/phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
parameters:
ignoreErrors:
-
message: '#^Function preg_match is unsafe to use\. It can return FALSE instead of throwing an exception\. Please add ''use function Safe\\preg_match;'' at the beginning of the file to use the variant provided by the ''thecodingmachine/safe'' library\.$#'
identifier: theCodingMachineSafe.function
count: 1
path: ../../src/CSSList/CSSList.php

-
message: '#^Parameter \#2 \$found of class Sabberworm\\CSS\\Parsing\\UnexpectedTokenException constructor expects string, Sabberworm\\CSS\\Value\\CSSFunction\|Sabberworm\\CSS\\Value\\CSSString\|Sabberworm\\CSS\\Value\\LineName\|Sabberworm\\CSS\\Value\\Size\|Sabberworm\\CSS\\Value\\URL given\.$#'
identifier: argument.type
Expand Down
6 changes: 3 additions & 3 deletions src/CSSList/CSSList.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
use Sabberworm\CSS\Value\URL;
use Sabberworm\CSS\Value\Value;

use function Safe\preg_match;

/**
* This is the most generic container available. It can contain `DeclarationBlock`s (rule sets with a selector),
* `RuleSet`s as well as other `CSSList` objects.
Expand Down Expand Up @@ -252,7 +250,9 @@ private static function identifierIs(string $identifier, string $match): bool
return true;
}

return preg_match("/^(-\\w+-)?$match$/i", $identifier) === 1;
$matchResult = \preg_match("/^(-\\w+-)?$match$/i", $identifier);
\assert(\is_int($matchResult));
return $matchResult === 1;
}

/**
Expand Down