@@ -23,6 +23,8 @@ class Preg
23
23
* @param array<string|null> $matches Set by method
24
24
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
25
25
* @return 0|1
26
+ *
27
+ * @param-out array<int|string, string|null> $matches
26
28
*/
27
29
public static function match (string $ pattern , string $ subject , ?array &$ matches = null , int $ flags = 0 , int $ offset = 0 ): int
28
30
{
@@ -44,7 +46,7 @@ public static function match(string $pattern, string $subject, ?array &$matches
44
46
* @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
45
47
* @return 0|1
46
48
*
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
48
50
*/
49
51
public static function matchWithOffsets (string $ pattern , string $ subject , ?array &$ matches , int $ flags = 0 , int $ offset = 0 ): int
50
52
{
@@ -61,6 +63,8 @@ public static function matchWithOffsets(string $pattern, string $subject, ?array
61
63
* @param array<int|string, list<string|null>> $matches Set by method
62
64
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_SET_ORDER> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
63
65
* @return 0|positive-int
66
+ *
67
+ * @param-out array<int|string, list<string|null>> $matches
64
68
*/
65
69
public static function matchAll (string $ pattern , string $ subject , ?array &$ matches = null , int $ flags = 0 , int $ offset = 0 ): int
66
70
{
@@ -103,6 +107,8 @@ public static function matchAllWithOffsets(string $pattern, string $subject, ?ar
103
107
* @param string|string[] $replacement
104
108
* @param string $subject
105
109
* @param int $count Set by method
110
+ *
111
+ * @param-out int<0, max> $count
106
112
*/
107
113
public static function replace ($ pattern , $ replacement , $ subject , int $ limit = -1 , int &$ count = null ): string
108
114
{
@@ -128,6 +134,8 @@ public static function replace($pattern, $replacement, $subject, int $limit = -1
128
134
* @param string $subject
129
135
* @param int $count Set by method
130
136
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_OFFSET_CAPTURE or PREG_UNMATCHED_AS_NULL, only available on PHP 7.4+
137
+ *
138
+ * @param-out int<0, max> $count
131
139
*/
132
140
public static function replaceCallback ($ pattern , callable $ replacement , $ subject , int $ limit = -1 , int &$ count = null , int $ flags = 0 ): string
133
141
{
@@ -156,6 +164,8 @@ public static function replaceCallback($pattern, callable $replacement, $subject
156
164
* @param string $subject
157
165
* @param int $count Set by method
158
166
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_OFFSET_CAPTURE or PREG_UNMATCHED_AS_NULL, only available on PHP 7.4+
167
+ *
168
+ * @param-out int<0, max> $count
159
169
*/
160
170
public static function replaceCallbackArray (array $ pattern , $ subject , int $ limit = -1 , int &$ count = null , int $ flags = 0 ): string
161
171
{
@@ -234,6 +244,8 @@ public static function grep(string $pattern, array $array, int $flags = 0): arra
234
244
* @param non-empty-string $pattern
235
245
* @param array<string|null> $matches Set by method
236
246
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
247
+ *
248
+ * @param-out array<int|string, string|null> $matches
237
249
*/
238
250
public static function isMatch (string $ pattern , string $ subject , ?array &$ matches = null , int $ flags = 0 , int $ offset = 0 ): bool
239
251
{
@@ -244,6 +256,8 @@ public static function isMatch(string $pattern, string $subject, ?array &$matche
244
256
* @param non-empty-string $pattern
245
257
* @param array<int|string, list<string|null>> $matches Set by method
246
258
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
259
+ *
260
+ * @param-out array<int|string, list<string|null>> $matches
247
261
*/
248
262
public static function isMatchAll (string $ pattern , string $ subject , ?array &$ matches = null , int $ flags = 0 , int $ offset = 0 ): bool
249
263
{
@@ -257,7 +271,7 @@ public static function isMatchAll(string $pattern, string $subject, ?array &$mat
257
271
* @param array<int|string, array{string|null, int}> $matches Set by method
258
272
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
259
273
*
260
- * @phpstan- param array<int|string, array{string|null, int<-1, max>}> $matches
274
+ * @param-out array<int|string, array{string|null, int<-1, max>}> $matches
261
275
*/
262
276
public static function isMatchWithOffsets (string $ pattern , string $ subject , ?array &$ matches , int $ flags = 0 , int $ offset = 0 ): bool
263
277
{
@@ -271,7 +285,7 @@ public static function isMatchWithOffsets(string $pattern, string $subject, ?arr
271
285
* @param array<int|string, list<array{string|null, int}>> $matches Set by method
272
286
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
273
287
*
274
- * @phpstan- param array<int|string, list<array{string|null, int<-1, max>}>> $matches
288
+ * @param-out array<int|string, list<array{string|null, int<-1, max>}>> $matches
275
289
*/
276
290
public static function isMatchAllWithOffsets (string $ pattern , string $ subject , ?array &$ matches , int $ flags = 0 , int $ offset = 0 ): bool
277
291
{
0 commit comments