Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | public function mockException($depth = 0) |
||
21 | { |
||
22 | switch ($depth) { |
||
23 | case 0: |
||
24 | try { |
||
25 | $this->mockException(1); |
||
26 | } catch (\Exception $ex) { |
||
27 | return $ex; |
||
28 | } |
||
29 | return null; |
||
30 | break; |
||
|
|||
31 | case 4: |
||
32 | throw new Exception('Error'); |
||
33 | default: |
||
34 | return $this->mockException($depth + 1); |
||
35 | } |
||
36 | } |
||
37 | } |
||
38 |
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.