Типы для php-lint v2

This commit is contained in:
origami11 2021-02-22 14:07:51 +03:00
parent f570da257d
commit 6173eb4892
31 changed files with 83 additions and 76 deletions

View file

@ -5,7 +5,7 @@ require_once "Database/PDOStatement.php";
/**
* Класс оболочка для PDO для замены Creole
*/
class Database extends PDO
class Database/*<Database_PDOStatement>*/ extends PDO
{
public $dsn;
@ -37,7 +37,7 @@ class Database extends PDO
if ($dsn['phptype'] == 'pgsql' || $dsn['phptype'] == 'mysql') {
$port = (isset($dsn['port'])) ? "port={$dsn['port']};" : "";
/*.Database.*/$connection = new static("{$dsn['phptype']}:host={$dsn['hostspec']}; $port dbname={$dsn['database']}", $dsn['username'], $dsn['password']);
$connection/*: Database*/ = new static("{$dsn['phptype']}:host={$dsn['hostspec']}; $port dbname={$dsn['database']}", $dsn['username'], $dsn['password']);
if ($dsn['phptype'] == 'pgsql') {
$connection->query('SET client_encoding="UTF-8"');
}
@ -47,7 +47,7 @@ class Database extends PDO
}
}
if ($dsn['phptype'] == 'sqlite') {
/*.Database.*/$connection = new static("{$dsn['phptype']}:{$dsn['database']}");
$connection/*: Database*/ = new static("{$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");
@ -65,7 +65,7 @@ class Database extends PDO
public function executeQuery($query, $values=null)
{
/*.Database_PDOStatement.*/$stmt = $this->prepare($query);
$stmt/*: Database_PDOStatement*/ = $this->prepare($query);
$stmt->execute($values);
$stmt->cache = $stmt->fetchAll(PDO::FETCH_ASSOC);
@ -83,7 +83,7 @@ class Database extends PDO
*/
public function fetchAllArray($query, $values = null)
{
/*.Database_PDOStatement.*/$sth = $this->prepare($query);
$sth/*: Database_PDOStatement*/ = $this->prepare($query);
$prep = $this->prepareValues($values);
$sth->execute($prep);
return $sth->fetchAll(PDO::FETCH_ASSOC);
@ -94,7 +94,7 @@ class Database extends PDO
*/
public function fetchOneArray($query, $values = null)
{
/*.Database_PDOStatement.*/$sth = $this->prepare($query);
$sth/*: Database_PDOStatement*/ = $this->prepare($query);
$prep = $this->prepareValues($values);
$sth->execute($prep);
return $sth->fetch(PDO::FETCH_ASSOC);