| 1 | <?php |
||
| 4 | class StringHelper |
||
| 5 | { |
||
| 6 | protected $string; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * StringHelper constructor. Accepts and stores a string. |
||
| 10 | * |
||
| 11 | * @throws \InvalidArgumentException if not initialized with a string |
||
| 12 | * |
||
| 13 | * @param string $string The string needing help |
||
| 14 | */ |
||
| 15 | 11 | public function __construct($string) |
|
| 23 | |||
| 24 | /** |
||
| 25 | * Given a delimited string, returns a copy of the string with chunks defined by the delimiter affected by a given |
||
| 26 | * function. |
||
| 27 | * |
||
| 28 | * @param callable $function The function to be called against the delimited chunks |
||
| 29 | * @param string[] $delimiters One or more strings delimiting the chunks |
||
|
|
|||
| 30 | * |
||
| 31 | * @return string A delimited string with chunks affected by the supplied function |
||
| 32 | */ |
||
| 33 | 4 | public function affectChunks(callable $function, ...$delimiters) |
|
| 53 | } |
||
| 54 |
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.