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

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

@ -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]);
}