diff --git a/src/Collection.php b/src/Collection.php index 1740ade..0604a06 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -48,6 +48,7 @@ class Collection implements \ArrayAccess * Read stored "request data" by referencing a key. * * @param string $key + * @param mixed $default * @return mixed */ public function get($key, $default = null) diff --git a/src/Controller/Action.php b/src/Controller/Action.php index 514b8cd..6948166 100644 --- a/src/Controller/Action.php +++ b/src/Controller/Action.php @@ -31,27 +31,26 @@ class Action implements ActionInterface public string $viewPathPrefix = ''; // Путь к шаблонам контроллера - /** - * Соединение с базой данных - */ + /** Соединение с базой данных */ public Database $db; // Фильтры - /** @var ?\ctiso\Filter\ActionAccess */ - public $access = null; // Обьект хранит параметры доступа - /** @var ?\ctiso\Filter\ActionLogger */ - public $logger = null; // Обьект для ведения лога - + /** @var ?\ctiso\Filter\ActionAccess Обьект хранит параметры доступа */ + public $access = null; + /** @var ?\ctiso\Filter\ActionLogger Обьект для ведения лога */ + public $logger = null; + /** @var Factory Обьект для создания моделей */ private $factory = null; // Ссылка на обьект создания модели private array $helpers = []; // Помошники для действий - public $part = null; // Параметры для ссылки + /** @var ?Url Параметры для ссылки */ + public $part = null; - /** @var \ctiso\Registry */ - public $config; // Ссылка на настройки - /** @var \ctiso\Role\User */ - public $user; // Обьект пользователя + /** @var \ctiso\Registry Ссылка на настройки */ + public $config; + /** @var \ctiso\Role\User Обьект пользователя */ + public $user; - // Для Widgets + /** @var \ctiso\View\View Для Widgets */ public $view = null; public array $childNodes = []; @@ -307,6 +306,8 @@ class Action implements ActionInterface /** * Вызов помошников контроллера + * @param HttpRequest $request + * @return mixed */ public function callHelpers(HttpRequest $request) { @@ -430,7 +431,7 @@ class Action implements ActionInterface /** * Проверка идентификатора страницы - * @param $page int Идентификатор страницы + * @param int $page Идентификатор страницы * @return bool */ function checkPageId(HttpRequest $request, $page) diff --git a/src/Controller/ActionInterface.php b/src/Controller/ActionInterface.php index b6551c9..97d3251 100644 --- a/src/Controller/ActionInterface.php +++ b/src/Controller/ActionInterface.php @@ -15,6 +15,7 @@ interface ActionInterface { /** * @param string $name * @param class-string<\ctiso\View\View> $class + * @return \ctiso\View\View */ function getView($name, $class); /** diff --git a/src/Controller/Component.php b/src/Controller/Component.php index a6e0e4d..18d87ea 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -84,7 +84,7 @@ class Component */ public $site; - function before() { + function before(): void { } /** @@ -308,9 +308,9 @@ class Component /** * Генерация интерфейса для выбора галлереи фотографии * @param Composite $view - * @param \ctiso\Form\OptionsFactory $options + * @param ?\ctiso\Form\OptionsFactory $options */ - public function setParameters(Composite $view, $options = null) + public function setParameters(Composite $view, $options = null): void { $form = new Form(); @@ -322,6 +322,10 @@ class Component $view->component_title = $settings['title']; } + /** + * @param \ctiso\Form\OptionsFactory $options + * @return array + */ public function getFields($options = null) { $form = new Form(); $form->addFieldList($this->getInfo()['parameter'], $options); diff --git a/src/Controller/Front.php b/src/Controller/Front.php index affe522..1a64a65 100644 --- a/src/Controller/Front.php +++ b/src/Controller/Front.php @@ -33,7 +33,9 @@ class Front extends Action /** @var array */ protected $modules = []; - + /** + * @param string $default + */ public function __construct(Database $db, Registry $config, User $user, $default) { parent::__construct(); $this->config = $config; diff --git a/src/Controller/Installer.php b/src/Controller/Installer.php index f925697..6aefd18 100644 --- a/src/Controller/Installer.php +++ b/src/Controller/Installer.php @@ -15,7 +15,7 @@ class Installer /** @var callable */ protected $installPath; /** @var Settings */ - public $_registry; + public $_registry; public function __construct(Settings $_registry) { @@ -27,7 +27,7 @@ class Installer * @param Manager $db_manager * @param callable $installPath */ - public function setUp($db_manager, $installPath) + public function setUp($db_manager, $installPath): void { $this->db_manager = $db_manager; $this->installPath = $installPath; diff --git a/src/Database.php b/src/Database.php index 5de9e52..94fb840 100644 --- a/src/Database.php +++ b/src/Database.php @@ -1,6 +1,10 @@ cursorPos !== 0) { $this->seek(0); } return $this->next(); diff --git a/src/Database/StatementIterator.php b/src/Database/StatementIterator.php index b3c4152..7a8b76f 100644 --- a/src/Database/StatementIterator.php +++ b/src/Database/StatementIterator.php @@ -5,7 +5,6 @@ use PDO; class StatementIterator implements \Iterator { - /** @var PDOStatement */ private $result; /** @var int */ @@ -44,6 +43,9 @@ class StatementIterator implements \Iterator $this->pos++; } + /** + * @param int $index + */ function seek($index): void { $this->pos = $index; } diff --git a/src/Excel/Table.php b/src/Excel/Table.php index 2e8b7c4..1a2a39b 100644 --- a/src/Excel/Table.php +++ b/src/Excel/Table.php @@ -82,6 +82,9 @@ class Table /** * Записать значение в клетку с заданными координатами + * @param int $x Номер ряда + * @param int $y Номер столбца + * @param string $value Значение клетки */ function setCell(int $x, int $y, $value): void { @@ -137,16 +140,15 @@ class Table /** * Обьединяет клетки в строке - * @param $row Номер ряда - * @param $cell Номер столбца - * @param $merge Количество клеток для обьединения + * @param int $x Номер ряда + * @param int $cell Номер столбца + * @param int $merge Количество клеток для обьединения */ function setCellMerge(int $x, int $cell, $merge): void { assert($x > 0); assert($cell > 0); - /** @var TableRow $row */ $row = $this->rows[$x]; $row->cells[$cell]->merge = $merge; } @@ -157,7 +159,7 @@ class Table * @param int $y Номер столбца * @param string $name Имя стиля */ - function setCellStyle ($row, $y, $name) + function setCellStyle ($row, $y, $name): void { if (isset($this->rows[$row])) { $this->rows[$row]->setCellStyle($y, $name); @@ -166,6 +168,7 @@ class Table /** * Добавляет строку к таблице + * @return int Номер добавленной строки */ function addRow(int $index = 1, array $data = [""]) { @@ -243,7 +246,7 @@ class Table * @param mixed $value Значение клетки * @param bool $setIndex Устанавливать индекс клетки в атрибут ss:Index */ - function createCell (TableCell $ncell, XMLWriter $doc, $j, mixed $value, $setIndex) { + function createCell (TableCell $ncell, XMLWriter $doc, $j, mixed $value, $setIndex): void { $doc->startElement("Cell"); if ($ncell->style) { diff --git a/src/Form/Field.php b/src/Form/Field.php index f7ae6f9..098003e 100644 --- a/src/Form/Field.php +++ b/src/Form/Field.php @@ -4,6 +4,8 @@ */ namespace ctiso\Form; +use ctiso\Form\OptionsFactory; + class Field { /** @var bool */ @@ -25,18 +27,26 @@ class Field public $error = false; /** @var bool */ public $require = false; + /** @var ?string */ public $hint = null; /** @var ?int */ public $maxlength = null; + /** @var ?string */ public $fieldset = null; // Блоки (Убрать в отдельный класс!!!) + /** @var array */ public $_title = []; /** @var string */ public $description = ""; /** @var array */ public $alias = []; - /** @phpstan-ignore-next-line */ + + /** + * @param array $input + * @param OptionsFactory|null $factory + * @phpstan-ignore-next-line + */ public function __construct ($input = [], $factory = null) { $this->default = null; diff --git a/src/Form/Form.php b/src/Form/Form.php index 4d0704f..7bfde94 100644 --- a/src/Form/Form.php +++ b/src/Form/Form.php @@ -16,7 +16,7 @@ use ctiso\HttpRequest; * Форма для ввода */ class Form { - /** @var array */ + /** @var array */ public $field = []; //Поля формы /** @var array */ public $fieldsets = []; //Группы полей (fieldset). Некоторые поля могут не принадлежать никаким группам @@ -137,6 +137,7 @@ class Form { /** * Добавляет список полей для формы * @param array $list + * @param OptionsFactory|null $factory */ public function addFieldList(array $list, $factory = null): void { @@ -191,6 +192,10 @@ class Form { } } + /** + * @param string $name + * @param mixed $value + */ public function set($name, $value): void { $this->field[$name]->setValue($value); diff --git a/src/Functions.php b/src/Functions.php index 64fd100..8f415f5 100644 --- a/src/Functions.php +++ b/src/Functions.php @@ -94,7 +94,12 @@ class partial { * Композиция функций */ class compose { + /** @var array */ protected $fns; + + /** + * @param array $list + */ function __construct($list) { $this->fns = array_reverse($list); } @@ -275,6 +280,7 @@ class Functions { /** * @param string $key * @param list|\ArrayIterator $array + * @return array */ static function key_values_object($key, $array) { $result = []; @@ -415,6 +421,7 @@ class Functions { * Поиск элемента в массиве * @param callable $cb сравнение с элементом массива * @param array $hs массив в котором ищется значение + * @param bool $strict * * @return int|string|null ключ найденого элемента в массиве */ diff --git a/src/Numbers.php b/src/Numbers.php index 368db12..f11678b 100644 --- a/src/Numbers.php +++ b/src/Numbers.php @@ -14,7 +14,10 @@ class Numbers return $i; } - static function prefix(callable $prefix, array $array, $key = false) + /** + * @param array $array + */ + static function prefix(callable $prefix, array $array) { $result = []; $count = count($array); diff --git a/src/Primitive.php b/src/Primitive.php index 13dc67b..746f868 100644 --- a/src/Primitive.php +++ b/src/Primitive.php @@ -53,6 +53,9 @@ class Primitive { return ((int) $value); } + /** + * @param mixed $value + */ public static function from_int($value): string { return ((string) $value); diff --git a/src/Role/UserInterface.php b/src/Role/UserInterface.php index 53e7150..5eb57d1 100644 --- a/src/Role/UserInterface.php +++ b/src/Role/UserInterface.php @@ -7,6 +7,6 @@ interface UserInterface { function getUserByQuery(Statement $stmt); function getUserByLogin(string $login); function getUserById(int $id); - function getName(); + function getName(): string; function setSID(string $random, $result); } \ No newline at end of file diff --git a/src/Settings.php b/src/Settings.php index 54491a9..1e75fc3 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -212,6 +212,7 @@ class Settings /** * Получение значения ключа * @param string $key Ключ + * @param mixed $default Значение по умолчанию * @return mixed */ public function get($key, $default = null) diff --git a/src/Setup.php b/src/Setup.php index b520bd7..4c83a9b 100644 --- a/src/Setup.php +++ b/src/Setup.php @@ -16,7 +16,7 @@ class FakeZipArchive { /** @var string */ public $base; - function open(string $path) { + function open(string $path): void { $this->base = $path; } @@ -95,6 +95,9 @@ class Setup $this->context[$name] = $value; } + /** + * @return string + */ function replaceFn(array $matches) { if (isset($this->context[$matches[2]])) { $v = $this->context[$matches[2]]; diff --git a/src/View/View.php b/src/View/View.php index e4a091d..45091a0 100644 --- a/src/View/View.php +++ b/src/View/View.php @@ -29,9 +29,9 @@ class View extends \stdClass /** @var string[] */ public array $suggestions = []; //подсказки - /** @var string[] $alias */ + /** @var array> */ public array $alias = []; - public $codeGenerator = null; + // public $codeGenerator = null; /** @var View|null */ public $parent_view = null; @@ -52,6 +52,9 @@ class View extends \stdClass } } + /** + * @param array $values + */ public function assignValues($values): void { $this->_values = $values; @@ -146,6 +149,9 @@ class View extends \stdClass return $title !== null; } + /** + * @param array> $alias + */ function setAlias($alias): void { $this->alias = $alias;