Постфиксная запись типов вместо префиксной

This commit is contained in:
CORP\phedor 2018-05-04 14:57:52 +03:00
parent 04662a94df
commit 11370eecc9
33 changed files with 95 additions and 79 deletions

View file

@ -43,7 +43,7 @@ class JsonInstall {
}
//Создать таблицы
function initDataBase(/*.array.*/$initActions, $dbinit_path) {
function initDataBase($initActions/*: array*/, $dbinit_path) {
$pg = $this->db_manager->db->isPostgres();
if (!$pg) {
$refs = [];

View file

@ -8,13 +8,13 @@ use ctiso\Database,
class 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);
@ -100,7 +100,7 @@ class 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];
@ -147,7 +147,7 @@ class Manager
$this->db->query($q);
}
function getConstraintDef(/*.array.*/$c) {
function getConstraintDef($c/*: array*/) {
if ($c['type'] == 'unique') {
return "UNIQUE(" . implode(", ", $c['fields']) . ")";
}
@ -175,8 +175,8 @@ class 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);
@ -184,7 +184,7 @@ class 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]);
}

View file

@ -16,7 +16,7 @@ class Statement
protected $conn;
protected $query;
function __construct($query, /*.Database.*/ $conn) {
function __construct($query, $conn/*: Database*/) {
$this->query = $query;
$this->conn = $conn;
}
@ -51,7 +51,7 @@ class Statement
if ($this->limit) {
$this->query .= " LIMIT {$this->limit} OFFSET {$this->offset}";
}
/*.PDOStatement.*/$stmt = $this->conn->prepare($this->query);
$stmt/*: PDOStatement*/ = $this->conn->prepare($this->query);
foreach ($this->binds as $bind) {
list($n, $value, $type) = $bind;
$stmt->bindValue($n, $value, (int) $type);

View file

@ -11,7 +11,7 @@ class StatementIterator implements \Iterator
private $fetchmode;
private $row_count;
public function __construct(/*.PDOStatement.*/ $rs) {
public function __construct($rs/*: PDOStatement*/) {
$this->result = $rs;
$this->row_count = $rs->getRecordCount();
}