1 | <?php |
||
5 | class StringUtils |
||
6 | { |
||
7 | /** |
||
8 | * Like {@link preg_replace_callback()}, it performs a string search and replace. The callback does not receive |
||
9 | * plain array of matches, but an extended array: each item is a pair of the matching portion of the needle and the |
||
10 | * byte offset to the subject, like {@link preg_match_all()} does with the `PREG_OFFSET_CAPTURE` flag. |
||
11 | * |
||
12 | * @param string $pattern |
||
13 | * @param callable $callback |
||
14 | * @param string|string[] $subject |
||
15 | * @param int $limit |
||
16 | * @param int|null $count |
||
17 | * @return string|string[] depending on whether <tt>$subject</tt> is <tt>string</tt> or <tt>array</tt>, |
||
|
|||
18 | * a <tt>string</tt> or <tt>array</tt> is returned |
||
19 | */ |
||
20 | public static function pregReplaceCallbackWithOffset( |
||
38 | |||
39 | private static function pregReplaceCallbackWithOffsetImpl( |
||
65 | |||
66 | /** |
||
67 | * @param int $num |
||
68 | * @return string "1st", "2nd", "3rd", "4th", etc. according to <tt>$num</tt> |
||
69 | */ |
||
70 | public static function englishOrd(int $num): string |
||
83 | |||
84 | /** |
||
85 | * @param int $len |
||
86 | * @return string a pseudo-random string of hexadecimal digits |
||
87 | */ |
||
88 | public static function randomHexString(int $len): string |
||
101 | } |
||
102 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.