Skip to content

Commit e788f3e

Browse files
authored
[BUGFIX] Use safe preg functions in SpecificityCalculator (#1384)
Part of #1168
1 parent 3bc7e7f commit e788f3e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Please also have a look at our
1818

1919
### Fixed
2020

21-
- Use typesafe versions of PHP functions (#1379, #1380, #1382, #1383)
21+
- Use typesafe versions of PHP functions (#1379, #1380, #1382, #1383, #1384)
2222

2323
### Documentation
2424

src/Property/Selector/SpecificityCalculator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Sabberworm\CSS\Property\Selector;
66

7+
use function Safe\preg_match_all;
8+
79
/**
810
* Utility class to calculate the specificity of a CSS selector.
911
*
@@ -67,8 +69,8 @@ public static function calculate(string $selector): int
6769
/// @todo should exclude \# as well as "#"
6870
$matches = null;
6971
$b = \substr_count($selector, '#');
70-
$c = \preg_match_all(self::NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX, $selector, $matches);
71-
$d = \preg_match_all(self::ELEMENTS_AND_PSEUDO_ELEMENTS_RX, $selector, $matches);
72+
$c = preg_match_all(self::NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX, $selector, $matches);
73+
$d = preg_match_all(self::ELEMENTS_AND_PSEUDO_ELEMENTS_RX, $selector, $matches);
7274
self::$cache[$selector] = ($a * 1000) + ($b * 100) + ($c * 10) + $d;
7375
}
7476

0 commit comments

Comments
 (0)