Skip to content

Commit 4482b64

Browse files
committed
Merge branch '2.x'
2 parents 6af1968 + 36d3086 commit 4482b64

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/Preg.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class Preg
2323
* @param array<string|null> $matches Set by method
2424
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
2525
* @return 0|1
26+
*
27+
* @param-out array<int|string, string|null> $matches
2628
*/
2729
public static function match(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
2830
{
@@ -44,7 +46,7 @@ public static function match(string $pattern, string $subject, ?array &$matches
4446
* @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
4547
* @return 0|1
4648
*
47-
* @phpstan-param array<int|string, array{string|null, int<-1, max>}> $matches
49+
* @param-out array<int|string, array{string|null, int<-1, max>}> $matches
4850
*/
4951
public static function matchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): int
5052
{
@@ -61,6 +63,8 @@ public static function matchWithOffsets(string $pattern, string $subject, ?array
6163
* @param array<int|string, list<string|null>> $matches Set by method
6264
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_SET_ORDER> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
6365
* @return 0|positive-int
66+
*
67+
* @param-out array<int|string, list<string|null>> $matches
6468
*/
6569
public static function matchAll(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
6670
{
@@ -103,6 +107,8 @@ public static function matchAllWithOffsets(string $pattern, string $subject, ?ar
103107
* @param string|string[] $replacement
104108
* @param string $subject
105109
* @param int $count Set by method
110+
*
111+
* @param-out int<0, max> $count
106112
*/
107113
public static function replace($pattern, $replacement, $subject, int $limit = -1, int &$count = null): string
108114
{
@@ -128,6 +134,8 @@ public static function replace($pattern, $replacement, $subject, int $limit = -1
128134
* @param string $subject
129135
* @param int $count Set by method
130136
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set
137+
*
138+
* @param-out int<0, max> $count
131139
*/
132140
public static function replaceCallback($pattern, callable $replacement, $subject, int $limit = -1, int &$count = null, int $flags = 0): string
133141
{
@@ -152,6 +160,8 @@ public static function replaceCallback($pattern, callable $replacement, $subject
152160
* @param string $subject
153161
* @param int $count Set by method
154162
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set
163+
*
164+
* @param-out int<0, max> $count
155165
*/
156166
public static function replaceCallbackArray(array $pattern, $subject, int $limit = -1, int &$count = null, int $flags = 0): string
157167
{
@@ -226,6 +236,8 @@ public static function grep(string $pattern, array $array, int $flags = 0): arra
226236
* @param non-empty-string $pattern
227237
* @param array<string|null> $matches Set by method
228238
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
239+
*
240+
* @param-out array<int|string, string|null> $matches
229241
*/
230242
public static function isMatch(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
231243
{
@@ -236,6 +248,8 @@ public static function isMatch(string $pattern, string $subject, ?array &$matche
236248
* @param non-empty-string $pattern
237249
* @param array<int|string, list<string|null>> $matches Set by method
238250
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
251+
*
252+
* @param-out array<int|string, list<string|null>> $matches
239253
*/
240254
public static function isMatchAll(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
241255
{
@@ -249,7 +263,7 @@ public static function isMatchAll(string $pattern, string $subject, ?array &$mat
249263
* @param array<int|string, array{string|null, int}> $matches Set by method
250264
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
251265
*
252-
* @phpstan-param array<int|string, array{string|null, int<-1, max>}> $matches
266+
* @param-out array<int|string, array{string|null, int<-1, max>}> $matches
253267
*/
254268
public static function isMatchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): bool
255269
{
@@ -263,7 +277,7 @@ public static function isMatchWithOffsets(string $pattern, string $subject, ?arr
263277
* @param array<int|string, list<array{string|null, int}>> $matches Set by method
264278
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
265279
*
266-
* @phpstan-param array<int|string, list<array{string|null, int<-1, max>}>> $matches
280+
* @param-out array<int|string, list<array{string|null, int<-1, max>}>> $matches
267281
*/
268282
public static function isMatchAllWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): bool
269283
{

0 commit comments

Comments
 (0)