Issues (41)

Driver/Sqlite.php (1 issue)

Severity
1
<?php
2
3
namespace WebStream\Database\Driver;
4
5
use Doctrine\DBAL\Configuration;
6
use Doctrine\DBAL\DriverManager;
7
use Doctrine\DBAL\Exception;
8
9
/**
10
 * Sqlite
11
 * @author Ryuichi TANAKA.
12
 * @since 2013/12/07
13
 * @version 0.4
14
 */
15
class Sqlite extends DatabaseDriver
16
{
17
    /**
18
     * {@inheritdoc}
19
     * @throws Exception
20
     */
21 25
    public function connect()
22
    {
23
        $params = [
24 25
            'path'     => $this->config->dbfile,
25 25
            'user'     => $this->config->username,
26 25
            'password' => $this->config->password,
27 25
            'driver'   => 'pdo_sqlite',
28 25
            'charset'  => 'utf8'
29
        ];
30
31 25
        $config = new Configuration([
0 ignored issues
show
The call to Doctrine\DBAL\Configuration::__construct() has too many arguments starting with array(PDO::ATTR_PERSISTE...PDO::ERRMODE_EXCEPTION). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
        $config = /** @scrutinizer ignore-call */ new Configuration([

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
32 25
            \PDO::ATTR_PERSISTENT => true,
33
            \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION
34
        ]);
35
36 25
        $this->connection = DriverManager::getConnection($params, $config);
37 25
        $this->logger->debug(get_class($this) . " connect.");
38 25
    }
39
}
40