| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 4 | public function affectChunks(callable $function, ...$delimiters) |
|
| 34 | { |
||
| 35 | 4 | $delimiter_string = ""; |
|
| 36 | 4 | $replace_callback = function ($matches) use ($function) { |
|
| 37 | |||
| 38 | 3 | $callback_string = $function($matches[0]); |
|
| 39 | |||
| 40 | 3 | return $callback_string; |
|
| 41 | 4 | }; |
|
| 42 | |||
| 43 | 4 | foreach ($delimiters as $delimiter) { |
|
| 44 | 4 | $delimiter_string .= preg_quote($delimiter, "/"); |
|
| 45 | 4 | } |
|
| 46 | |||
| 47 | 4 | $pattern = "/[^{$delimiter_string}]+/"; |
|
| 48 | |||
| 49 | 4 | $affected_string = preg_replace_callback($pattern, $replace_callback, $this->string); |
|
| 50 | |||
| 51 | 4 | return $affected_string; |
|
| 52 | } |
||
| 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.