chore: Аннотация типов
This commit is contained in:
parent
cf0bc435ce
commit
f07a668b30
14 changed files with 62 additions and 19 deletions
|
|
@ -3,7 +3,7 @@
|
|||
namespace ctiso;
|
||||
/**
|
||||
* Коллекция
|
||||
*
|
||||
* @implements \ArrayAccess<string,mixed>
|
||||
*/
|
||||
class Collection implements \ArrayAccess
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class Action implements ActionInterface
|
|||
|
||||
// Параметры устанавливаются при создании контроллера
|
||||
public string $name = ''; // Имя модуля
|
||||
/** @var \ctiso\Controller\Front */
|
||||
public $front;
|
||||
|
||||
public string $modulePath = ''; // Путь к модулю
|
||||
|
|
@ -283,7 +284,7 @@ class Action implements ActionInterface
|
|||
/**
|
||||
* Генерация ссылки на действие контроллера
|
||||
* Ajax определяется автоматически mode = ajax используется для смены layout
|
||||
* @param $name
|
||||
* @param string $name
|
||||
* @param array $param
|
||||
* @return Url|null
|
||||
*
|
||||
|
|
@ -299,7 +300,7 @@ class Action implements ActionInterface
|
|||
* Добавление помошника контроллера
|
||||
* @param class-string $class
|
||||
*/
|
||||
public function addHelper($class)
|
||||
public function addHelper($class): void
|
||||
{
|
||||
$this->helpers [] = $class;
|
||||
}
|
||||
|
|
@ -323,10 +324,11 @@ class Action implements ActionInterface
|
|||
|
||||
/**
|
||||
* Загрузка файла класса
|
||||
* @deprecated
|
||||
* @deprecated Веместо его нужно использовать автозагрузку
|
||||
* @param string $path
|
||||
* @param mixed $setup
|
||||
* @param string $prefix
|
||||
* @return mixed
|
||||
*/
|
||||
public function loadClass($path, $setup = null, $prefix = '')
|
||||
{
|
||||
|
|
@ -350,6 +352,9 @@ class Action implements ActionInterface
|
|||
return $result->export();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function setView($name): void
|
||||
{
|
||||
$this->view = $this->getView($name);
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ class Installer
|
|||
* @param string $dbinit_path
|
||||
* @param string|null $dbfill_path
|
||||
*/
|
||||
function install($dbinit_path, $dbfill_path = null)
|
||||
function install($dbinit_path, $dbfill_path = null): void
|
||||
{
|
||||
$json_installer = new JsonInstall($this->db_manager);
|
||||
$json_installer->install($dbinit_path, $dbfill_path);
|
||||
|
|
|
|||
|
|
@ -3,13 +3,26 @@
|
|||
namespace ctiso\Controller;
|
||||
|
||||
interface SiteInterface {
|
||||
/**
|
||||
* FIXME: Возвращает ресурс (но его тип опрделяется в App)
|
||||
* @return mixed
|
||||
*/
|
||||
function getResource();
|
||||
/**
|
||||
* @return \ctiso\Database
|
||||
*/
|
||||
function getDatabase();
|
||||
/**
|
||||
* @return \ctiso\Registry
|
||||
*/
|
||||
function getConfig();
|
||||
/**
|
||||
* @return \ctiso\Settings
|
||||
*/
|
||||
function getTheme();
|
||||
/**
|
||||
* @param array $config
|
||||
*/
|
||||
function addComponentConfig($config): void;
|
||||
function addRequireJsPath(string $name, string $path, ?array $shim = null): void;
|
||||
function addStyleSheet(string $url): void;
|
||||
|
|
@ -19,7 +32,10 @@ interface SiteInterface {
|
|||
* @return ?Component
|
||||
*/
|
||||
function loadComponent(string $expression);
|
||||
/**
|
||||
* @return array{string, string, string}
|
||||
*/
|
||||
function findTemplate(string $name);
|
||||
function replaceImg(string $src, int $width, int $height);
|
||||
function replaceImg(string $src, int $width, int $height): string;
|
||||
function updatePageTime(int $time): void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ use ctiso\Database\StatementIterator,
|
|||
PDO;
|
||||
use TheSeer\Tokenizer\Exception;
|
||||
|
||||
/**
|
||||
* @implements \IteratorAggregate<int, array>
|
||||
*/
|
||||
class PDOStatement extends \PDOStatement implements \IteratorAggregate
|
||||
{
|
||||
/** @var int */
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
namespace ctiso\Database;
|
||||
use PDO;
|
||||
|
||||
/**
|
||||
* @implements \Iterator<array>
|
||||
*/
|
||||
class StatementIterator implements \Iterator
|
||||
{
|
||||
/** @var PDOStatement */
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class TableCell
|
|||
public $style = false;
|
||||
/** @var string */
|
||||
public $value;
|
||||
/** @var bool */
|
||||
public $merge = false;
|
||||
|
||||
/**
|
||||
|
|
@ -142,7 +143,7 @@ class Table
|
|||
* Обьединяет клетки в строке
|
||||
* @param int $x Номер ряда
|
||||
* @param int $cell Номер столбца
|
||||
* @param int $merge Количество клеток для обьединения
|
||||
* @param bool $merge Количество клеток для обьединения
|
||||
*/
|
||||
function setCellMerge(int $x, int $cell, $merge): void
|
||||
{
|
||||
|
|
@ -254,7 +255,7 @@ class Table
|
|||
}
|
||||
|
||||
if ($ncell->merge) {
|
||||
$doc->writeAttribute('ss:MergeAcross', $ncell->merge);
|
||||
$doc->writeAttribute('ss:MergeAcross', (string)$ncell->merge);
|
||||
}
|
||||
|
||||
if ($setIndex) {
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ class Functions {
|
|||
* @example key_values('a', array(1 => array('a' => 1, 'b' => 2))) => array(1)
|
||||
*
|
||||
* @param string $key
|
||||
* @param list<array>|\ArrayIterator $array
|
||||
* @param list<array>|\ArrayIterator<int, array> $array
|
||||
* @return mixed
|
||||
*/
|
||||
static function key_values($key, $array) {
|
||||
|
|
@ -279,7 +279,7 @@ class Functions {
|
|||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param list<object>|\ArrayIterator $array
|
||||
* @param list<object>|\ArrayIterator<int, object> $array
|
||||
* @return array<mixed>
|
||||
*/
|
||||
static function key_values_object($key, $array) {
|
||||
|
|
@ -294,7 +294,7 @@ class Functions {
|
|||
/**
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
* @param list<array<string, mixed>>|\ArrayIterator $array
|
||||
* @param list<array<string, mixed>>|\ArrayIterator<int, array> $array
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
static function assoc_key_values($key, $value, $array) {
|
||||
|
|
@ -307,7 +307,7 @@ class Functions {
|
|||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param list<array<string, mixed>>|\ArrayIterator $array
|
||||
* @param list<array<string, mixed>>|\ArrayIterator<int, array> $array
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
static function assoc_key($key, $array) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class Numbers
|
|||
|
||||
/**
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
static function prefix(callable $prefix, array $array)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -96,9 +96,10 @@ class User implements UserInterface
|
|||
/**
|
||||
* @param string $random
|
||||
* @param PDOStatement $result
|
||||
* @return PDOStatement
|
||||
* @return PDOStatement|bool
|
||||
*/
|
||||
function setSID(string $random, $result) {
|
||||
function setSID(string $random, $result)
|
||||
{
|
||||
return $this->db->executeQuery("UPDATE users SET sid = :sid, trie_count = 0 WHERE id_user = :user", [
|
||||
'user' => $result->getInt('id_user'),
|
||||
'sid' => $random
|
||||
|
|
|
|||
|
|
@ -2,11 +2,18 @@
|
|||
|
||||
namespace ctiso\Role;
|
||||
use ctiso\Database\Statement;
|
||||
use ctiso\Database\PDOStatement;
|
||||
|
||||
interface UserInterface {
|
||||
function getUserByQuery(Statement $stmt);
|
||||
function getUserByLogin(string $login);
|
||||
function getUserById(int $id);
|
||||
function getUserByQuery(Statement $stmt): ?PDOStatement;
|
||||
function getUserByLogin(string $login): ?PDOStatement;
|
||||
function getUserById(int $id): ?PDOStatement;
|
||||
function getName(): string;
|
||||
|
||||
/**
|
||||
* @param string $random
|
||||
* @param PDOStatement $result
|
||||
* @return PDOStatement|bool
|
||||
*/
|
||||
function setSID(string $random, $result);
|
||||
}
|
||||
|
|
@ -121,6 +121,7 @@ class Settings
|
|||
/**
|
||||
* Чтение ключа из реестра
|
||||
* @param array $key Путь к значению ключа
|
||||
* @param array $data
|
||||
* @return mixed
|
||||
*/
|
||||
protected function readKeyData(array $key, $data)
|
||||
|
|
@ -145,6 +146,7 @@ class Settings
|
|||
/**
|
||||
* Чтение ключа из реестра (Собирает все ключи с определенным значением во всех модулях)
|
||||
* @param mixed $key Путь к значению ключа внутри модуля
|
||||
* @return array
|
||||
*/
|
||||
public function readKeyList(...$key)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class Setup
|
|||
* @param string $name
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function set(string $name, $value)
|
||||
public function set(string $name, $value): void
|
||||
{
|
||||
$this->context[$name] = $value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Plain extends \stdClass
|
|||
* @param string $key ключ
|
||||
* @param mixed $value значение
|
||||
*/
|
||||
public function set($key, $value)
|
||||
public function set($key, $value): void
|
||||
{
|
||||
$this->values[$key] = $value;
|
||||
}
|
||||
|
|
@ -40,6 +40,10 @@ class Plain extends \stdClass
|
|||
$this->values = array_merge($this->values, $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key ключ
|
||||
* @param mixed $value значение
|
||||
*/
|
||||
public function __set($key, $value): void
|
||||
{
|
||||
$this->set($key, $value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue