chore: Аннотации к типам

This commit is contained in:
origami11@yandex.ru 2025-10-28 20:09:21 +03:00
parent 245b5c6c19
commit 704e4e0bd5
10 changed files with 73 additions and 11 deletions

View file

@ -18,6 +18,7 @@ class JsonInstall {
* Установить базу данных
* @param string $dbinit_path
* @param ?string $dbfill_path
* @return int
*/
function install($dbinit_path, $dbfill_path = null) {
$dbinit_file = file_get_contents($dbinit_path);
@ -37,6 +38,7 @@ class JsonInstall {
$this->fillDataBase($dbfill_path);
}
$this->makeConstraints($initActions);
return 1;
}
/**

View file

@ -7,6 +7,36 @@ use ctiso\Tools\SQLStatementExtractor;
use ctiso\Path;
use Exception;
/**
* @phpstan-type Action array{
* type:string,
* table_name:string,
* table:string,
* fields:array,
* field: ColumnProps,
* constraints:?array,
* references:?array,
* source:string,
* pgsql?:string,
* old_name?:string,
* new_name?:string,
* column?:string,
* column_name?:string,
* refTable?:string,
* refColumn?:string,
* values:array,
* view:string,
* select:string
* }
*
* @phpstan-type ColumnProps array{
* name:string,
* type:string,
* not_null:bool,
* default:?string,
* references:?array{refTable:string,refColumn:string}
* }
*/
class Manager
{
/** @var Database */
@ -19,7 +49,7 @@ class Manager
/**
* Выполняет действие
* @param array $action
* @param Action $action
* @param string $db_file
* @throws Exception
*/
@ -180,7 +210,7 @@ class Manager
/**
* Возвращает определение столбца
* @param string $name
* @param array $data
* @param ColumnProps $data
* @param bool $pg
* @return string
*/