chore: Проверки для типов

This commit is contained in:
origami11@yandex.ru 2025-12-01 16:19:28 +03:00
parent 6fdc3eb46b
commit 5d3fae4249
15 changed files with 125 additions and 42 deletions

View file

@ -8,27 +8,67 @@ use ctiso\Path;
use Exception;
/**
* @phpstan-type Action array{
* type:string,
* @phpstan-type DropAction array{
* type:"dropTable",
* table_name:string
* }
*
* @phpstan-type CreateAction array{
* type:"createTable",
* table_name:string,
* table:string,
* fields:array<mixed>,
* field: ColumnProps,
* constraints:?array<mixed>,
* references:?array<mixed>,
* fields:array<mixed>,
* }
*
* @phpstan-type AddColumnAction array{
* type:"addColumn",
* table_name:string,
* column_name:string,
* field:ColumnProps
* }
*
* @phpstan-type AlterReferenceAction array{
* type:"alterReference",
* table:string,
* column:string,
* refTable:string,
* refColumn:string
* }
*
* @phpstan-type RenameColumnAction array{
* type:"renameColumn",
* table:string,
* old_name:string,
* new_name:string
* }
*
* @phpstan-type ExecuteFileAction array{
* type:"executeFile",
* source:string,
* pgsql?:string,
* old_name?:string,
* new_name?:string,
* column?:string,
* column_name?:string,
* refTable?:string,
* refColumn?:string,
* values:array<mixed>,
* pgsql:?string
* }
*
* @phpstan-type CreateViewAction array{
* type:"createView",
* view:string,
* select:string
* }
*
* @phpstan-type InsertAction array{
* type:"insert",
* table_name:string,
* values:array<mixed>
* }
*
* @phpstan-type Action DropAction
* | CreateAction
* | AddColumnAction
* | AlterReferenceAction
* | RenameColumnAction
* | ExecuteFileAction
* | CreateViewAction
* | InsertAction
*
* @phpstan-type ColumnProps array{
* name:string,
* type:string,
@ -266,7 +306,7 @@ class Manager
* @example createTableQuery('users',['id'=>['type'=>'integer','constraint'=>'PRIMARY KEY']])
* @param string $table
* @param array $fields
* @param array|string|null $constraints
* @param array{fields: array<string>, type: string}|string|null $constraints
*/
public function createTableQuery($table, $fields, $constraints): void
{