Conditions | 6 |
Paths | 8 |
Total Lines | 21 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | public function __construct($databaseProvider) |
||
25 | { |
||
26 | $this->sql = false; |
||
|
|||
27 | if (is_a($databaseProvider, mysqli::class)) { |
||
28 | $this->sql = $databaseProvider; |
||
29 | } elseif (is_a($databaseProvider, CacheableDatabase::class)) { |
||
30 | $this->sql = $databaseProvider->sql; |
||
31 | } elseif (is_a($databaseProvider, Toolbox::class)) { |
||
32 | $this->sql = $databaseProvider->getMySql(); |
||
33 | } |
||
34 | |||
35 | if (!is_a($this->sql, mysqli::class)) { |
||
36 | throw new SnapshotException( |
||
37 | 'Database provider not recognized (instance of ' . (is_object($databaseProvider) ? |
||
38 | get_class($databaseProvider) : |
||
39 | gettype($databaseProvider) |
||
40 | ) .')', |
||
41 | SnapshotException::MYSQL |
||
42 | ); |
||
43 | } |
||
44 | } |
||
45 | |||
63 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..