It seems like $connection defined by new \Wandu\Database\Configuration($connection) on line 21 can also be of type object<Wandu\Database\Co...ts\ConnectionInterface>; however, Wandu\Database\Configuration::__construct() does only seem to accept array, maybe add an additional type check?
If a method or function can return multiple different values and unless you are
sure that you only can receive a single value in this context, we recommend
to add an additional type check:
/** * @return array|string */functionreturnsDifferentValues($x){if($x){return'foo';}returnarray();}$x=returnsDifferentValues($y);if(is_array($x)){// $x is an array.}
If this a common case that PHP Analyzer should handle natively, please let us
know by opening an issue.
Loading history...
22
}
23
17
if (!$connection instanceof ConnectionInterface) {
24
17
switch ($connection->getDriver()) {
25
17
case Configuration::DRIVER_MYSQL:
26
16
$connection = new MysqlConnection($connection);
27
16
break;
28
default:
29
1
throw new DriverNotFoundException($connection->getDriver());
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.