@@ -20,7 +20,7 @@ class Extract
20
20
* @param mixed $chars The number of characters to extract (as an integer)
21
21
* Or can be an array of values
22
22
*
23
- * @return array|string The joined string
23
+ * @return array<mixed> |string The joined string
24
24
* If an array of values is passed for the $value or $chars arguments, then the returned result
25
25
* will also be an array with matching dimensions
26
26
*/
@@ -50,7 +50,7 @@ public static function left(mixed $value, mixed $chars = 1): array|string
50
50
* @param mixed $chars The number of characters to extract (as an integer)
51
51
* Or can be an array of values
52
52
*
53
- * @return array|string The joined string
53
+ * @return array<mixed> |string The joined string
54
54
* If an array of values is passed for the $value, $start or $chars arguments, then the returned result
55
55
* will also be an array with matching dimensions
56
56
*/
@@ -79,7 +79,7 @@ public static function mid(mixed $value, mixed $start, mixed $chars): array|stri
79
79
* @param mixed $chars The number of characters to extract (as an integer)
80
80
* Or can be an array of values
81
81
*
82
- * @return array|string The joined string
82
+ * @return array<mixed> |string The joined string
83
83
* If an array of values is passed for the $value or $chars arguments, then the returned result
84
84
* will also be an array with matching dimensions
85
85
*/
@@ -104,7 +104,7 @@ public static function right(mixed $value, mixed $chars = 1): array|string
104
104
*
105
105
* @param mixed $text the text that you're searching
106
106
* Or can be an array of values
107
- * @param null|array|string $delimiter the text that marks the point before which you want to extract
107
+ * @param null|array<string> |string $delimiter the text that marks the point before which you want to extract
108
108
* Multiple delimiters can be passed as an array of string values
109
109
* @param mixed $instance The instance of the delimiter after which you want to extract the text.
110
110
* By default, this is the first instance (1).
@@ -118,11 +118,11 @@ public static function right(mixed $value, mixed $chars = 1): array|string
118
118
* 0 - Don't match the delimiter against the end of the text.
119
119
* 1 - Match the delimiter against the end of the text.
120
120
* Or can be an array of values
121
- * @param mixed $ifNotFound value to return if no match is found
121
+ * @param array<string>|bool|float|int|string $ifNotFound value to return if no match is found
122
122
* The default is a #N/A Error
123
123
* Or can be an array of values
124
124
*
125
- * @return array|string the string extracted from text before the delimiter; or the $ifNotFound value
125
+ * @return array<mixed> |string the string extracted from text before the delimiter; or the $ifNotFound value
126
126
* If an array of values is passed for any of the arguments, then the returned result
127
127
* will also be an array with matching dimensions
128
128
*/
@@ -168,7 +168,7 @@ public static function before(mixed $text, $delimiter, mixed $instance = 1, mixe
168
168
* TEXTAFTER.
169
169
*
170
170
* @param mixed $text the text that you're searching
171
- * @param null|array|string $delimiter the text that marks the point before which you want to extract
171
+ * @param null|array<string> |string $delimiter the text that marks the point before which you want to extract
172
172
* Multiple delimiters can be passed as an array of string values
173
173
* @param mixed $instance The instance of the delimiter after which you want to extract the text.
174
174
* By default, this is the first instance (1).
@@ -182,11 +182,11 @@ public static function before(mixed $text, $delimiter, mixed $instance = 1, mixe
182
182
* 0 - Don't match the delimiter against the end of the text.
183
183
* 1 - Match the delimiter against the end of the text.
184
184
* Or can be an array of values
185
- * @param mixed $ifNotFound value to return if no match is found
185
+ * @param array<string>|scalar $ifNotFound value to return if no match is found
186
186
* The default is a #N/A Error
187
187
* Or can be an array of values
188
188
*
189
- * @return array|string the string extracted from text before the delimiter; or the $ifNotFound value
189
+ * @return array<mixed> |string the string extracted from text before the delimiter; or the $ifNotFound value
190
190
* If an array of values is passed for any of the arguments, then the returned result
191
191
* will also be an array with matching dimensions
192
192
*/
@@ -228,6 +228,12 @@ public static function after(mixed $text, $delimiter, mixed $instance = 1, mixed
228
228
return implode ('' , $ split );
229
229
}
230
230
231
+ /**
232
+ * @param null|array<string>|string $delimiter
233
+ * @param array<string>|scalar $ifNotFound
234
+ *
235
+ * @return array<string>|string
236
+ */
231
237
private static function validateTextBeforeAfter (string $ text , null |array |string $ delimiter , int $ instance , int $ matchMode , int $ matchEnd , mixed $ ifNotFound ): array |string
232
238
{
233
239
$ flags = self ::matchFlags ($ matchMode );
@@ -256,7 +262,7 @@ private static function validateTextBeforeAfter(string $text, null|array|string
256
262
}
257
263
258
264
/**
259
- * @param null|array|string $delimiter the text that marks the point before which you want to extract
265
+ * @param null|array<string> |string $delimiter the text that marks the point before which you want to extract
260
266
* Multiple delimiters can be passed as an array of string values
261
267
*/
262
268
private static function buildDelimiter ($ delimiter ): string
0 commit comments