Типы для php-lint v2
This commit is contained in:
parent
f570da257d
commit
6173eb4892
31 changed files with 83 additions and 76 deletions
|
|
@ -40,7 +40,7 @@ class Database_JsonInstall {
|
|||
}
|
||||
|
||||
//Создать таблицы
|
||||
function initDataBase(/*.array.*/$initActions, $dbinit_path) {
|
||||
function initDataBase($initActions/*: array*/, $dbinit_path) {
|
||||
$pg = $this->db_manager->db->isPostgres();
|
||||
if (!$pg) {
|
||||
$refs = [];
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
class Database_Manager
|
||||
{
|
||||
public /*.Database.*/$db;
|
||||
public $db/*: Database*/;
|
||||
|
||||
function __construct(Database $db) {
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
public function ExecuteAction(/*.array.*/$action, $db_file = "") {
|
||||
public function ExecuteAction($action/*: array*/, $db_file = "") {
|
||||
switch($action["type"]) {
|
||||
case "dropTable":
|
||||
$this->DropTableQuery($action["table_name"], true);
|
||||
|
|
@ -94,7 +94,7 @@ class Database_Manager
|
|||
return;
|
||||
}
|
||||
|
||||
/*.array.*/$data = $this->DumpTable($table);
|
||||
$data/*: array*/ = $this->DumpTable($table);
|
||||
|
||||
$this->db->query("ALTER TABLE ".$table." RENAME TO ".$tmp_table.";");
|
||||
$table_info[$new_name] = $table_info[$old_name];
|
||||
|
|
@ -141,7 +141,7 @@ class Database_Manager
|
|||
$this->db->query($q);
|
||||
}
|
||||
|
||||
function getConstraintDef(/*.array.*/$c) {
|
||||
function getConstraintDef($c/*: array*/) {
|
||||
if ($c['type'] == 'unique') {
|
||||
return "UNIQUE(" . implode(", ", $c['fields']) . ")";
|
||||
}
|
||||
|
|
@ -169,8 +169,8 @@ class Database_Manager
|
|||
public function DumpTable($table_name) {
|
||||
$pg = $this->db->isPostgres();
|
||||
|
||||
/*.array.*/$result = array();
|
||||
/*.array.*/$data = $this->db->fetchAllArray("SELECT * FROM ".$table_name.";");
|
||||
$result/*: array*/ = array();
|
||||
$data/*: array*/ = $this->db->fetchAllArray("SELECT * FROM ".$table_name.";");
|
||||
|
||||
if (!$pg) {
|
||||
$table_fields = $this->TableInfo($table_name);
|
||||
|
|
@ -178,7 +178,7 @@ class Database_Manager
|
|||
$type = strtolower($value['type']);
|
||||
if ($type == "boolean") {
|
||||
foreach ($data as &$row) {
|
||||
/*.array.*/$row = $row;
|
||||
$row/*: array*/ = $row;
|
||||
if (isset($row[$name])) {
|
||||
$row[$name] = boolval($row[$name]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class Database_PDOStatement extends PDOStatement implements IteratorAggregate
|
|||
}
|
||||
|
||||
function getInt($name) {
|
||||
return intval($this->fields[$name]);
|
||||
return (int)$this->fields[$name];
|
||||
}
|
||||
|
||||
function getBlob($name) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class Database_Statement
|
|||
protected $conn;
|
||||
protected $query;
|
||||
|
||||
function __construct($query, /*.Database.*/ $conn) {
|
||||
function __construct($query, $conn/*: Database*/) {
|
||||
$this->query = $query;
|
||||
$this->conn = $conn;
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ class Database_Statement
|
|||
if ($this->limit) {
|
||||
$this->query .= " LIMIT {$this->limit} OFFSET {$this->offset}";
|
||||
}
|
||||
/*.Database_PDOStatement.*/$stmt = $this->conn->prepare($this->query);
|
||||
$stmt/*: Database_PDOStatement*/ = $this->conn->prepare($this->query);
|
||||
foreach ($this->binds as $bind) {
|
||||
list($n, $value, $type) = $bind;
|
||||
$stmt->bindValue($n, $value, (int) $type);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class Database_StatementIterator implements Iterator
|
|||
private $fetchmode;
|
||||
private $row_count;
|
||||
|
||||
public function __construct(/*.Database_PDOStatement.*/ $rs) {
|
||||
public function __construct($rs/*: Database_PDOStatement*/) {
|
||||
$this->result = $rs;
|
||||
$this->row_count = $rs->getRecordCount();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue