You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vendor/composer/pcre/src/Preg.php
+20-19Lines changed: 20 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ class Preg
18
18
publicconstINVALID_TYPE_MSG = '$subject must be a string, %s given.';
19
19
/**
20
20
* @param non-empty-string $pattern
21
-
* @param array<string|null> $matches Set by method
21
+
* @param array<mixed> $matches Set by method
22
22
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
23
23
* @return 0|1
24
24
*
@@ -37,7 +37,7 @@ public static function match(string $pattern, string $subject, ?array &$matches
37
37
* Variant of `match()` which outputs non-null matches (or throws)
38
38
*
39
39
* @param non-empty-string $pattern
40
-
* @param array<string> $matches Set by method
40
+
* @param array<mixed> $matches Set by method
41
41
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
42
42
* @return 0|1
43
43
* @throws UnexpectedNullMatchException
@@ -54,7 +54,7 @@ public static function matchStrictGroups(string $pattern, string $subject, ?arra
54
54
* Runs preg_match with PREG_OFFSET_CAPTURE
55
55
*
56
56
* @param non-empty-string $pattern
57
-
* @param array<int|string, array{string|null, int}> $matches Set by method
57
+
* @param array<mixed> $matches Set by method
58
58
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_UNMATCHED_AS_NULL and PREG_OFFSET_CAPTURE are always set, no other flags are supported
59
59
* @return 0|1
60
60
*
@@ -70,7 +70,7 @@ public static function matchWithOffsets(string $pattern, string $subject, ?array
70
70
}
71
71
/**
72
72
* @param non-empty-string $pattern
73
-
* @param array<int|string, list<string|null>> $matches Set by method
73
+
* @param array<mixed> $matches Set by method
74
74
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
75
75
* @return 0|positive-int
76
76
*
@@ -91,7 +91,7 @@ public static function matchAll(string $pattern, string $subject, ?array &$match
91
91
* Variant of `match()` which outputs non-null matches (or throws)
92
92
*
93
93
* @param non-empty-string $pattern
94
-
* @param array<int|string, list<string|null>> $matches Set by method
94
+
* @param array<mixed> $matches Set by method
95
95
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
96
96
* @return 0|positive-int
97
97
* @throws UnexpectedNullMatchException
@@ -108,7 +108,7 @@ public static function matchAllStrictGroups(string $pattern, string $subject, ?a
108
108
* Runs preg_match_all with PREG_OFFSET_CAPTURE
109
109
*
110
110
* @param non-empty-string $pattern
111
-
* @param array<int|string, list<array{string|null, int}>> $matches Set by method
111
+
* @param array<mixed> $matches Set by method
112
112
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_UNMATCHED_AS_NULL and PREG_MATCH_OFFSET are always set, no other flags are supported
113
113
* @return 0|positive-int
114
114
*
@@ -148,7 +148,7 @@ public static function replace($pattern, $replacement, $subject, int $limit = -1
thrownewUnexpectedNullMatchException('Pattern "' . $pattern . '" had an unexpected unmatched group "' . $group . '", make sure the pattern always matches or use ' . $variantMethod . '() instead.');
358
+
if (\is_string($match) || \is_array($match) && \is_string($match[0])) {
359
+
continue;
360
360
}
361
+
thrownewUnexpectedNullMatchException('Pattern "' . $pattern . '" had an unexpected unmatched group "' . $group . '", make sure the pattern always matches or use ' . $variantMethod . '() instead.');
0 commit comments