Issues (41)

Driver/Postgresql.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
 * Postgresql
11
 * @author Ryuichi TANAKA.
12
 * @since 2014/01/03
13
 * @version 0.4
14
 */
15
class Postgresql extends DatabaseDriver
16
{
17
    /**
18
     * {@inheritdoc}
19
     * @throws Exception
20
     */
21 25
    public function connect()
22
    {
23
        $params = [
24 25
            'dbname'   => $this->config->dbname,
25 25
            'user'     => $this->config->username,
26 25
            'password' => $this->config->password,
27 25
            'host'     => $this->config->host,
28 25
            'port'     => $this->config->port,
29 25
            'driver'   => 'pdo_pgsql',
30 25
            'charset'  => 'utf8'
31
        ];
32
33 25
        $config = new Configuration([\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION]);
0 ignored issues
show
The call to Doctrine\DBAL\Configuration::__construct() has too many arguments starting with array(PDO::ATTR_ERRMODE ...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

33
        $config = /** @scrutinizer ignore-call */ new Configuration([\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION]);

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...
34 25
        $this->connection = DriverManager::getConnection($params, $config);
35
36 25
        $this->logger->debug(get_class($this) . " connect.");
37 25
    }
38
}
39