| Conditions | 3 |
| Paths | 3 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 3 | public static function get(array $params = null) : DBALConnection |
|
| 27 | { |
||
| 28 | 3 | if(!is_null($params)) { |
|
| 29 | 2 | self::$conn = DriverManager::getConnection($params); |
|
| 30 | 2 | return self::$conn; |
|
| 31 | } |
||
| 32 | 3 | if(!is_null(self::$conn)) { |
|
| 33 | 1 | return self::$conn; |
|
| 34 | } |
||
| 35 | 2 | ConnectionException::undefined(); |
|
|
|
|||
| 36 | } |
||
| 43 | } |
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: