| Conditions | 8 |
| Paths | 7 |
| Total Lines | 20 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | private function validate($decodedRule, $type): bool |
||
| 27 | { |
||
| 28 | switch ($type) { |
||
| 29 | case 'single': |
||
| 30 | if (isset($decodedRule['date'])) { |
||
| 31 | return $decodedRule; |
||
| 32 | } |
||
| 33 | break; |
||
| 34 | case 'period': |
||
| 35 | if (isset($decodedRule['from']) && isset($decodedRule['to'])) { |
||
| 36 | return true; |
||
| 37 | } |
||
| 38 | break; |
||
| 39 | case 'recurrent_day': |
||
| 40 | if (isset($decodedRule['dayOfWeek'])) { |
||
| 41 | return true; |
||
| 42 | } |
||
| 43 | break; |
||
| 44 | } |
||
| 45 | $this->throwException(); |
||
|
|
|||
| 46 | } |
||
| 56 |
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: