Conditions | 4 |
Paths | 6 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
29 | public function processNode(Node $switch, Scope $scope): array |
||
30 | { |
||
31 | $errors = []; |
||
32 | $defaultFound = false; |
||
33 | foreach ($switch->cases as $case) { |
||
34 | if ($case->cond === null) { |
||
35 | $defaultFound = true; |
||
36 | break; |
||
37 | } |
||
38 | } |
||
39 | |||
40 | if (!$defaultFound) { |
||
41 | $errors[] = sprintf(PrefixGenerator::generatePrefix($scope).'switch statement does not have a "default" case. If your code is supposed to enter at least one "case" or another, consider adding a "default" case that throws an exception.'); |
||
42 | } |
||
43 | |||
44 | return $errors; |
||
45 | } |
||
46 | } |
||
47 |