webstream-framework /
Database
| 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
|
|||
| 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 |
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.