Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | public static function datasourceFromDbConnection(Connection $connection) |
||
21 | { |
||
22 | $driverType = $connection->getDriver()->getName(); |
||
23 | |||
24 | switch ($driverType) { |
||
25 | case 'pdo_mysql': |
||
26 | return new MySql($connection); |
||
27 | break; |
||
|
|||
28 | case 'pdo_sqlite': |
||
29 | return new Sqlite($connection); |
||
30 | break; |
||
31 | default: |
||
32 | throw new \InvalidArgumentException("Can't use Db of type $driverType"); |
||
33 | } |
||
34 | } |
||
35 | } |
||
36 |
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.