@@ -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 or PREG_UNMATCHED_AS_NULL, only available on PHP 7.4+
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 {
@@ -156,6 +164,8 @@ public static function replaceCallback($pattern, callable $replacement, $subject
156164 * @param string $subject
157165 * @param int $count Set by method
158166 * @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
159169 */
160170 public static function replaceCallbackArray (array $ pattern , $ subject , int $ limit = -1 , int &$ count = null , int $ flags = 0 ): string
161171 {
@@ -234,6 +244,8 @@ public static function grep(string $pattern, array $array, int $flags = 0): arra
234244 * @param non-empty-string $pattern
235245 * @param array<string|null> $matches Set by method
236246 * @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
237249 */
238250 public static function isMatch (string $ pattern , string $ subject , ?array &$ matches = null , int $ flags = 0 , int $ offset = 0 ): bool
239251 {
@@ -244,6 +256,8 @@ public static function isMatch(string $pattern, string $subject, ?array &$matche
244256 * @param non-empty-string $pattern
245257 * @param array<int|string, list<string|null>> $matches Set by method
246258 * @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
247261 */
248262 public static function isMatchAll (string $ pattern , string $ subject , ?array &$ matches = null , int $ flags = 0 , int $ offset = 0 ): bool
249263 {
@@ -257,7 +271,7 @@ public static function isMatchAll(string $pattern, string $subject, ?array &$mat
257271 * @param array<int|string, array{string|null, int}> $matches Set by method
258272 * @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
259273 *
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
261275 */
262276 public static function isMatchWithOffsets (string $ pattern , string $ subject , ?array &$ matches , int $ flags = 0 , int $ offset = 0 ): bool
263277 {
@@ -271,7 +285,7 @@ public static function isMatchWithOffsets(string $pattern, string $subject, ?arr
271285 * @param array<int|string, list<array{string|null, int}>> $matches Set by method
272286 * @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
273287 *
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
275289 */
276290 public static function isMatchAllWithOffsets (string $ pattern , string $ subject , ?array &$ matches , int $ flags = 0 , int $ offset = 0 ): bool
277291 {
0 commit comments