Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
31 | 6 | private function parseComposite(string $value): array |
|
32 | { |
||
33 | 6 | for ($result = [], $i = 1;; ++$i) { |
|
34 | 6 | $result[] = match ($value[$i]) { |
|
35 | 6 | ',', ')' => null, |
|
36 | 6 | '"' => $this->parseQuotedString($value, $i), |
|
37 | 6 | default => $this->parseUnquotedString($value, $i), |
|
38 | 6 | }; |
|
39 | |||
40 | 6 | if ($value[$i] === ')') { |
|
41 | 6 | return $result; |
|
42 | } |
||
77 |
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: