fix: phpstan. Удаление State

This commit is contained in:
origami11@yandex.ru 2024-01-24 12:49:11 +03:00
parent 4ac027b8ee
commit 1638d558c5
6 changed files with 22 additions and 97 deletions

View file

@ -51,7 +51,7 @@ class Database/*<Database_PDOStatement>*/ extends PDO
$connection = null;
if ($dsn['phptype'] == 'pgsql' || $dsn['phptype'] == 'mysql') {
$port = (isset($dsn['port'])) ? "port={$dsn['port']};" : "";
$connection/*: Database*/ = new static("{$dsn['phptype']}:host={$dsn['hostspec']}; $port dbname={$dsn['database']}", $dsn['username'], $dsn['password']);
$connection/*: Database*/ = new self("{$dsn['phptype']}:host={$dsn['hostspec']}; $port dbname={$dsn['database']}", $dsn['username'], $dsn['password']);
if ($dsn['phptype'] == 'pgsql') {
$connection->query('SET client_encoding="UTF-8"');
}
@ -61,7 +61,7 @@ class Database/*<Database_PDOStatement>*/ extends PDO
}
}
if ($dsn['phptype'] == 'sqlite') {
$connection/*: Database*/ = new static("{$dsn['phptype']}:{$dsn['database']}");
$connection/*: Database*/ = new self("{$dsn['phptype']}:{$dsn['database']}");
$connection->setAttribute(PDO::ATTR_TIMEOUT, 5);
$mode = defined('SQLITE_JOURNAL_MODE') ? SQLITE_JOURNAL_MODE : 'WAL';
$connection->query("PRAGMA journal_mode=$mode");