Conditions | 4 |
Paths | 5 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
25 | public function parse(string $input): Result |
||
26 | { |
||
27 | $results = []; |
||
28 | $unparsed = $input; |
||
29 | while (true) { |
||
30 | $result = $this->parser->parse($unparsed); |
||
31 | |||
32 | if ($result->use()) { |
||
33 | $results[] = $result->data(); |
||
34 | } |
||
35 | |||
36 | if (!$result->ok()) { |
||
37 | return Ok::with($results, $unparsed); |
||
38 | } |
||
39 | |||
40 | $unparsed = $result->unparsed(); |
||
41 | } |
||
44 |
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: