Преглед изворни кода

Up min PHP version from 7.3 to 8.0

Visman пре 2 година
родитељ
комит
5528d0480b

+ 1 - 8
app/Controllers/Install.php

@@ -15,15 +15,8 @@ use ForkBB\Models\Page;
 
 
 class Install
 class Install
 {
 {
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
-
-    public function __construct(Container $container)
+    public function __construct(protected Container $c)
     {
     {
-        $this->c = $container;
     }
     }
 
 
     /**
     /**

+ 1 - 8
app/Controllers/Primary.php

@@ -15,15 +15,8 @@ use ForkBB\Models\Page;
 
 
 class Primary
 class Primary
 {
 {
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
-
-    public function __construct(Container $container)
+    public function __construct(protected Container $c)
     {
     {
-        $this->c = $container;
     }
     }
 
 
     /**
     /**

+ 1 - 8
app/Controllers/Routing.php

@@ -15,15 +15,8 @@ use ForkBB\Models\Page;
 
 
 class Routing
 class Routing
 {
 {
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
-
-    public function __construct(Container $container)
+    public function __construct(protected Container $c)
     {
     {
-        $this->c = $container;
     }
     }
 
 
     /**
     /**

+ 1 - 8
app/Controllers/Update.php

@@ -15,15 +15,8 @@ use ForkBB\Models\Page;
 
 
 class Update
 class Update
 {
 {
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
-
-    public function __construct(Container $container)
+    public function __construct(protected Container $c)
     {
     {
-        $this->c = $container;
     }
     }
 
 
     /**
     /**

+ 11 - 18
app/Core/Config.php

@@ -16,45 +16,38 @@ class Config
 {
 {
     /**
     /**
      * Путь до файла конфига
      * Путь до файла конфига
-     * @var string
      */
      */
-    protected $path;
+    protected string $path;
 
 
     /**
     /**
      * Содержимое файла конфига
      * Содержимое файла конфига
-     * @var string
      */
      */
-    protected $fileContents;
+    protected string $fileContents;
 
 
     /**
     /**
      * Начальная позиция массива конфига
      * Начальная позиция массива конфига
-     * @var int
      */
      */
-    protected $arrayStartPos;
+    protected int $arrayStartPos;
 
 
     /**
     /**
      * Массив токенов
      * Массив токенов
-     * @var array
      */
      */
-    protected $tokens;
+    protected array $tokens;
 
 
     /**
     /**
      * Текущая позиция в массиве токенов
      * Текущая позиция в массиве токенов
-     * @var int
      */
      */
-    protected $position;
+    protected int $position;
 
 
     /**
     /**
      * Массив полученый из файла настройки путем его парсинга
      * Массив полученый из файла настройки путем его парсинга
-     * @var array
      */
      */
-    protected $configArray;
+    protected array $configArray;
 
 
     /**
     /**
      * Строка массива конфига в файле конфигурации
      * Строка массива конфига в файле конфигурации
-     * @var string
      */
      */
-    protected $configStr;
+    protected string $configStr;
 
 
     public function __construct(string $path)
     public function __construct(string $path)
     {
     {
@@ -133,7 +126,7 @@ class Config
     /**
     /**
      * Очищает ключ от кавычек
      * Очищает ключ от кавычек
      */
      */
-    protected function clearKey(/* mixed */ $key)
+    protected function clearKey(mixed $key): string
     {
     {
         if (! \is_string($key)) {
         if (! \is_string($key)) {
             throw new ForkException('Config array cannot be parsed (2)');
             throw new ForkException('Config array cannot be parsed (2)');
@@ -315,7 +308,7 @@ class Config
         }
         }
     }
     }
 
 
-    protected function isFormat(/* mixed */ $data): bool
+    protected function isFormat(mixed $data): bool
     {
     {
         return \is_array($data)
         return \is_array($data)
         && \array_key_exists('value', $data)
         && \array_key_exists('value', $data)
@@ -328,7 +321,7 @@ class Config
     /**
     /**
      * Добавляет/заменяет элемент в конфиг(е)
      * Добавляет/заменяет элемент в конфиг(е)
      */
      */
-    public function add(string $path, /* mixed */ $value, string $after = null): bool
+    public function add(string $path, mixed $value, string $after = null): bool
     {
     {
         if (empty($this->configArray)) {
         if (empty($this->configArray)) {
             $this->configArray = $this->getArray();
             $this->configArray = $this->getArray();
@@ -405,7 +398,7 @@ class Config
     /**
     /**
      * Удаляет элемент из конфига
      * Удаляет элемент из конфига
      */
      */
-    public function delete(string $path)
+    public function delete(string $path): mixed
     {
     {
         if (empty($this->configArray)) {
         if (empty($this->configArray)) {
             $this->configArray = $this->getArray();
             $this->configArray = $this->getArray();

+ 8 - 8
app/Core/Container.php

@@ -18,9 +18,9 @@ use InvalidArgumentException;
  */
  */
 class Container
 class Container
 {
 {
-    protected $instances = [];
-    protected $shared    = [];
-    protected $multiple  = [];
+    protected array $instances = [];
+    protected array $shared    = [];
+    protected array $multiple  = [];
 
 
     public function __construct(array $config = null)
     public function __construct(array $config = null)
     {
     {
@@ -64,7 +64,7 @@ class Container
     /**
     /**
      * Gets a service or parameter.
      * Gets a service or parameter.
      */
      */
-    public function __get(string $key) /* : mixed */
+    public function __get(string $key): mixed
     {
     {
         if (\array_key_exists($key, $this->instances)) {
         if (\array_key_exists($key, $this->instances)) {
             return $this->instances[$key];
             return $this->instances[$key];
@@ -132,7 +132,7 @@ class Container
      * Sets a service or parameter.
      * Sets a service or parameter.
      * Provides a fluent interface.
      * Provides a fluent interface.
      */
      */
-    public function __set(string $key, /* mixed */ $service): void
+    public function __set(string $key, mixed $service): void
     {
     {
         if (false !== \strpos($key, '.')) {
         if (false !== \strpos($key, '.')) {
             throw new InvalidArgumentException("Wrong property name: {$key}");
             throw new InvalidArgumentException("Wrong property name: {$key}");
@@ -144,7 +144,7 @@ class Container
     /**
     /**
      * Gets data from array.
      * Gets data from array.
      */
      */
-    public function fromArray(array $array, array $tree) /* : mixed */
+    public function fromArray(array $array, array $tree): mixed
     {
     {
         $ptr = &$array;
         $ptr = &$array;
 
 
@@ -163,7 +163,7 @@ class Container
      * Sets a parameter.
      * Sets a parameter.
      * Provides a fluent interface.
      * Provides a fluent interface.
      */
      */
-    public function setParameter(string $name, /* mixed */ $value): Container
+    public function setParameter(string $name, mixed $value): Container
     {
     {
         $segments = \explode('.', $name);
         $segments = \explode('.', $name);
         $n        = \count($segments);
         $n        = \count($segments);
@@ -186,7 +186,7 @@ class Container
         return $this;
         return $this;
     }
     }
 
 
-    protected function resolve(/* mixed */ $value) /* : mixed */
+    protected function resolve(mixed $value): mixed
     {
     {
         if (\is_string($value)) {
         if (\is_string($value)) {
             if (false !== \strpos($value, '%')) {
             if (false !== \strpos($value, '%')) {

+ 6 - 28
app/Core/Csrf.php

@@ -17,33 +17,11 @@ class Csrf
 {
 {
     const TOKEN_LIFETIME = 1800;
     const TOKEN_LIFETIME = 1800;
 
 
-    /**
-     * @var Secury
-     */
-    protected $secury;
-
-    /**
-     * @var string
-     */
-    protected $key;
+    protected ?string $error = null;
+    protected int $hashExpiration = 3600;
 
 
-    /**
-     * @var ?string
-     */
-    protected $error;
-
-    /**
-     * @var int
-     */
-    protected $hashExpiration = 3600;
-
-    public function __construct(
-        Secury $secury,
-        #[SensitiveParameter]
-        string $key
-    ) {
-        $this->secury = $secury;
-        $this->key    = \sha1($key);
+    public function __construct(protected Secury $secury, #[SensitiveParameter] protected string $key)
+    {
     }
     }
 
 
     /**
     /**
@@ -57,7 +35,7 @@ class Csrf
     /**
     /**
      * Возвращает csrf токен
      * Возвращает csrf токен
      */
      */
-    public function create(string $marker, array $args = [], /* string|int */ $time = null): string
+    public function create(string $marker, array $args = [], int|string $time = null): string
     {
     {
         $marker      = $this->argsToStr($marker, $args);
         $marker      = $this->argsToStr($marker, $args);
         $time        = $time ?: \time();
         $time        = $time ?: \time();
@@ -68,7 +46,7 @@ class Csrf
     /**
     /**
      * Возвращает хэш
      * Возвращает хэш
      */
      */
-    public function createHash(string $marker, array $args = [], /* string|int */ $time = null): string
+    public function createHash(string $marker, array $args = [], int|string $time = null): string
     {
     {
         $marker      = $this->argsToStr($marker, $args, ['hash']);
         $marker      = $this->argsToStr($marker, $args, ['hash']);
         $time        = $time ?: \time() + $this->hashExpiration;
         $time        = $time ?: \time() + $this->hashExpiration;

+ 16 - 27
app/Core/DB.php

@@ -19,27 +19,24 @@ use SensitiveParameter;
 class DB
 class DB
 {
 {
     /**
     /**
-     * @var PDO
+     * Экземпляр PDO через который идет работа с бд
      */
      */
-    protected $pdo;
+    protected PDO $pdo;
 
 
     /**
     /**
      * Префикс для таблиц базы
      * Префикс для таблиц базы
-     * @var string
      */
      */
-    protected $dbPrefix;
+    protected string $dbPrefix;
 
 
     /**
     /**
      * Тип базы данных
      * Тип базы данных
-     * @var string
      */
      */
-    protected $dbType;
+    protected string $dbType;
 
 
     /**
     /**
      * Имя класса для драйвера
      * Имя класса для драйвера
-     * @var string
      */
      */
-    protected $dbDrvClass;
+    protected string $dbDrvClass;
 
 
     /**
     /**
      * Драйвер текущей базы
      * Драйвер текущей базы
@@ -49,32 +46,25 @@ class DB
 
 
     /**
     /**
      * Имя класса для PDOStatement
      * Имя класса для PDOStatement
-     * @var string
      */
      */
-    protected $statementClass;
+    protected string $statementClass;
 
 
     /**
     /**
      * Количество выполненных запросов
      * Количество выполненных запросов
-     * @var int
      */
      */
-    protected $qCount = 0;
+    protected int $qCount = 0;
 
 
     /**
     /**
      * Выполненные запросы
      * Выполненные запросы
-     * @var array
      */
      */
-    protected $queries = [];
+    protected array $queries = [];
 
 
     /**
     /**
      * Дельта времени для следующего запроса
      * Дельта времени для следующего запроса
-     * @var float
      */
      */
-    protected $delta = 0;
+    protected float $delta = 0;
 
 
-    /**
-     * @var array
-     */
-    protected $pdoMethods = [
+    protected array $pdoMethods = [
         'beginTransaction'      => true,
         'beginTransaction'      => true,
         'commit'                => true,
         'commit'                => true,
         'errorCode'             => true,
         'errorCode'             => true,
@@ -108,8 +98,7 @@ class DB
     public function __construct(
     public function __construct(
         string $dsn,
         string $dsn,
         string $username = null,
         string $username = null,
-        #[SensitiveParameter]
-        string $password = null,
+        #[SensitiveParameter] string $password = null,
         array $options = [],
         array $options = [],
         string $prefix = ''
         string $prefix = ''
     ) {
     ) {
@@ -270,7 +259,7 @@ class DB
     /**
     /**
      * Метод возвращает значение из массива параметров по ключу или исключение
      * Метод возвращает значение из массива параметров по ключу или исключение
      */
      */
-    public function getValue(/* int|string */ $key, array $params) /* : mixed */
+    public function getValue(int|string $key, array $params): mixed
     {
     {
         if (
         if (
             \is_string($key)
             \is_string($key)
@@ -330,7 +319,7 @@ class DB
     /**
     /**
      * Метод расширяет PDO::exec()
      * Метод расширяет PDO::exec()
      */
      */
-    public function exec(string $query, array $params = []) /* : int|false */
+    public function exec(string $query, array $params = []): int|false
     {
     {
         $map = $this->parse($query, $params);
         $map = $this->parse($query, $params);
 
 
@@ -365,7 +354,7 @@ class DB
     /**
     /**
      * Метод расширяет PDO::prepare()
      * Метод расширяет PDO::prepare()
      */
      */
-    public function prepare(string $query, array $params = [], array $options = []) /* : DBStatement|false */
+    public function prepare(string $query, array $params = [], array $options = []): DBStatement|false
     {
     {
         $map         = $this->parse($query, $params);
         $map         = $this->parse($query, $params);
         $start       = \microtime(true);
         $start       = \microtime(true);
@@ -387,7 +376,7 @@ class DB
     /**
     /**
      * Метод расширяет PDO::query()
      * Метод расширяет PDO::query()
      */
      */
-    public function query(string $query, /* mixed */ ...$args) /* : DBStatement|false */
+    public function query(string $query, mixed ...$args): DBStatement|false
     {
     {
         if (
         if (
             isset($args[0])
             isset($args[0])
@@ -478,7 +467,7 @@ class DB
     /**
     /**
      * Передает вызовы метода в PDO или драйвер текущей базы
      * Передает вызовы метода в PDO или драйвер текущей базы
      */
      */
-    public function __call(string $name, array $args) /* : mixed */
+    public function __call(string $name, array $args): mixed
     {
     {
         if (isset($this->pdoMethods[$name])) {
         if (isset($this->pdoMethods[$name])) {
             return $this->pdo->$name(...$args);
             return $this->pdo->$name(...$args);

+ 6 - 11
app/Core/DB/AbstractStatement.php

@@ -19,36 +19,31 @@ abstract class AbstractStatement extends DBStatement
 {
 {
     /**
     /**
      * Типы столбцов полученные через getColumnMeta()
      * Типы столбцов полученные через getColumnMeta()
-     * @var array
      */
      */
-    protected $columnsType;
+    protected ?array $columnsType = null;
 
 
     /**
     /**
      * Режим выборки установленный через setFetchMode()/fetchAll()
      * Режим выборки установленный через setFetchMode()/fetchAll()
-     * @var int
      */
      */
-    protected $fetchMode;
+    protected int $fetchMode;
 
 
     /**
     /**
      * colno, class или object из setFetchMode()/fetchAll()
      * colno, class или object из setFetchMode()/fetchAll()
-     * @var mixed
      */
      */
-    protected $fetchArg;
+    protected mixed $fetchArg;
 
 
     /**
     /**
      * constructorArgs из setFetchMode()/fetchAll()
      * constructorArgs из setFetchMode()/fetchAll()
-     * @var array
      */
      */
-    protected $ctorArgs;
+    protected ?array $ctorArgs = null;
 
 
     /**
     /**
      * Флаг успешного завершения fetch() для PDO::FETCH_COLUMN
      * Флаг успешного завершения fetch() для PDO::FETCH_COLUMN
-     * @var bool
      */
      */
-    protected $okFetchColumn;
+    protected bool $okFetchColumn;
 
 
     abstract public function getColumnsType(): array;
     abstract public function getColumnsType(): array;
-    abstract protected function convToBoolean(/* mixed */ $value): bool;
+    abstract protected function convToBoolean(mixed $value): bool;
 
 
     protected function setFetchVars(int $mode, ...$args): void
     protected function setFetchVars(int $mode, ...$args): void
     {
     {

+ 4 - 18
app/Core/DB/DBStatement.php

@@ -22,27 +22,15 @@ class DBStatement
     const INTEGER = 'i';
     const INTEGER = 'i';
     const STRING  = 's';
     const STRING  = 's';
 
 
-    /**
-     * @var DB
-     */
-    protected $db;
-
-    /**
-     * @var PDOStatement
-     */
-    protected $stmt;
-
     /**
     /**
      * Карта преобразования переменных
      * Карта преобразования переменных
-     * @var array
      */
      */
-    protected $map = [];
+    protected array $map = [];
 
 
     /**
     /**
      * Карта типов
      * Карта типов
-     * @var array
      */
      */
-    protected $types = [
+    protected array $types = [
         'b'  => PDO::PARAM_BOOL,
         'b'  => PDO::PARAM_BOOL,
         'f'  => PDO::PARAM_STR,
         'f'  => PDO::PARAM_STR,
         'i'  => PDO::PARAM_INT,
         'i'  => PDO::PARAM_INT,
@@ -52,10 +40,8 @@ class DBStatement
         'as' => PDO::PARAM_STR,
         'as' => PDO::PARAM_STR,
     ];
     ];
 
 
-    public function __construct(DB $db, PDOStatement $stmt)
+    public function __construct(protected DB $db, protected PDOStatement $stmt)
     {
     {
-        $this->db   = $db;
-        $this->stmt = $stmt;
     }
     }
 
 
     /**
     /**
@@ -115,7 +101,7 @@ class DBStatement
     /**
     /**
      * Передает вызовы метода в PDOStatement
      * Передает вызовы метода в PDOStatement
      */
      */
-    public function __call(string $name, array $args) /* : mixed */
+    public function __call(string $name, array $args): mixed
     {
     {
         return $this->stmt->$name(...$args);
         return $this->stmt->$name(...$args);
     }
     }

+ 7 - 24
app/Core/DB/Mysql.php

@@ -17,30 +17,17 @@ use PDOException;
 
 
 class Mysql
 class Mysql
 {
 {
-    /**
-     * @var DB
-     */
-    protected $db;
-
-    /**
-     * Префикс для таблиц базы
-     * @var string
-     */
-    protected $dbPrefix;
-
     /**
     /**
      * Массив замены типов полей таблицы
      * Массив замены типов полей таблицы
-     * @var array
      */
      */
-    protected $dbTypeRepl = [
+    protected array $dbTypeRepl = [
         '%^SERIAL$%i' => 'INT(10) UNSIGNED AUTO_INCREMENT',
         '%^SERIAL$%i' => 'INT(10) UNSIGNED AUTO_INCREMENT',
     ];
     ];
 
 
     /**
     /**
      * Подстановка типов полей для карты БД
      * Подстановка типов полей для карты БД
-     * @var array
      */
      */
-    protected $types = [
+    protected array $types = [
         'bool'      => 'b',
         'bool'      => 'b',
         'boolean'   => 'b',
         'boolean'   => 'b',
         'tinyint'   => 'i',
         'tinyint'   => 'i',
@@ -55,13 +42,9 @@ class Mysql
         'double'    => 'i',
         'double'    => 'i',
     ];
     ];
 
 
-    public function __construct(DB $db, string $prefix)
+    public function __construct(protected DB $db, protected string $dbPrefix)
     {
     {
-        $this->db = $db;
-
-        $this->nameCheck($prefix);
-
-        $this->dbPrefix = $prefix;
+        $this->nameCheck($dbPrefix);
     }
     }
 
 
     /**
     /**
@@ -129,7 +112,7 @@ class Mysql
     /**
     /**
      * Конвертирует данные в строку для DEFAULT
      * Конвертирует данные в строку для DEFAULT
      */
      */
-    protected function convToStr(/* mixed */ $data): string
+    protected function convToStr(mixed $data): string
     {
     {
         if (\is_string($data)) {
         if (\is_string($data)) {
             return $this->db->quote($data);
             return $this->db->quote($data);
@@ -336,7 +319,7 @@ class Mysql
     /**
     /**
      * Добавляет поле в таблицу
      * Добавляет поле в таблицу
      */
      */
-    public function addField(string $table, string $field, string $type, bool $allowNull, /* mixed */ $default = null, string $collate = null, string $after = null): bool
+    public function addField(string $table, string $field, string $type, bool $allowNull, mixed $default = null, string $collate = null, string $after = null): bool
     {
     {
         $table = $this->tName($table);
         $table = $this->tName($table);
 
 
@@ -358,7 +341,7 @@ class Mysql
     /**
     /**
      * Модифицирует поле в таблице
      * Модифицирует поле в таблице
      */
      */
-    public function alterField(string $table, string $field, string $type, bool $allowNull, /* mixed */ $default = null, string $collate = null, string $after = null): bool
+    public function alterField(string $table, string $field, string $type, bool $allowNull, mixed $default = null, string $collate = null, string $after = null): bool
     {
     {
         $table = $this->tName($table);
         $table = $this->tName($table);
         $query = "ALTER TABLE `{$table}` MODIFY " . $this->buildColumn($field, [$type, $allowNull, $default, $collate]);
         $query = "ALTER TABLE `{$table}` MODIFY " . $this->buildColumn($field, [$type, $allowNull, $default, $collate]);

+ 6 - 23
app/Core/DB/Pgsql.php

@@ -17,22 +17,10 @@ use PDOException;
 
 
 class Pgsql
 class Pgsql
 {
 {
-    /**
-     * @var DB
-     */
-    protected $db;
-
-    /**
-     * Префикс для таблиц базы
-     * @var string
-     */
-    protected $dbPrefix;
-
     /**
     /**
      * Массив замены типов полей таблицы
      * Массив замены типов полей таблицы
-     * @var array
      */
      */
-    protected $dbTypeRepl = [
+    protected array $dbTypeRepl = [
         '%^(?:TINY|SMALL)INT(?:\s*\(\d+\))?(?:\s*UNSIGNED)?$%i'          => 'SMALLINT',
         '%^(?:TINY|SMALL)INT(?:\s*\(\d+\))?(?:\s*UNSIGNED)?$%i'          => 'SMALLINT',
         '%^(?:MEDIUM)?INT(?:\s*\(\d+\))?(?:\s*UNSIGNED)?$%i'             => 'INTEGER',
         '%^(?:MEDIUM)?INT(?:\s*\(\d+\))?(?:\s*UNSIGNED)?$%i'             => 'INTEGER',
         '%^BIGINT(?:\s*\(\d+\))?(?:\s*UNSIGNED)?$%i'                     => 'BIGINT',
         '%^BIGINT(?:\s*\(\d+\))?(?:\s*UNSIGNED)?$%i'                     => 'BIGINT',
@@ -43,9 +31,8 @@ class Pgsql
 
 
     /**
     /**
      * Подстановка типов полей для карты БД
      * Подстановка типов полей для карты БД
-     * @var array
      */
      */
-    protected $types = [
+    protected array $types = [
         'bool'      => 'b',
         'bool'      => 'b',
         'boolean'   => 'b',
         'boolean'   => 'b',
         'tinyint'   => 'i',
         'tinyint'   => 'i',
@@ -62,13 +49,9 @@ class Pgsql
         'double precision' => 'i',
         'double precision' => 'i',
     ];
     ];
 
 
-    public function __construct(DB $db, string $prefix)
+    public function __construct(protected DB $db, protected string $dbPrefix)
     {
     {
-        $this->db = $db;
-
-        $this->nameCheck($prefix);
-
-        $this->dbPrefix = $prefix;
+        $this->nameCheck($dbPrefix);
     }
     }
 
 
     /**
     /**
@@ -345,7 +328,7 @@ class Pgsql
     /**
     /**
      * Добавляет поле в таблицу
      * Добавляет поле в таблицу
      */
      */
-    public function addField(string $table, string $field, string $type, bool $allowNull, /* mixed */ $default = null, string $collate = null, string $after = null): bool
+    public function addField(string $table, string $field, string $type, bool $allowNull, mixed $default = null, string $collate = null, string $after = null): bool
     {
     {
         $table = $this->tName($table);
         $table = $this->tName($table);
 
 
@@ -361,7 +344,7 @@ class Pgsql
     /**
     /**
      * Модифицирует поле в таблице
      * Модифицирует поле в таблице
      */
      */
-    public function alterField(string $table, string $field, string $type, bool $allowNull, /* mixed */ $default = null, string $collate = null, string $after = null): bool
+    public function alterField(string $table, string $field, string $type, bool $allowNull, mixed $default = null, string $collate = null, string $after = null): bool
     {
     {
         $this->nameCheck($field);
         $this->nameCheck($field);
 
 

+ 6 - 23
app/Core/DB/Sqlite.php

@@ -17,22 +17,10 @@ use PDOException;
 
 
 class Sqlite
 class Sqlite
 {
 {
-    /**
-     * @var DB
-     */
-    protected $db;
-
-    /**
-     * Префикс для таблиц базы
-     * @var string
-     */
-    protected $dbPrefix;
-
     /**
     /**
      * Массив замены типов полей таблицы
      * Массив замены типов полей таблицы
-     * @var array
      */
      */
-    protected $dbTypeRepl = [
+    protected array $dbTypeRepl = [
         '%^.*?INT.*$%i'                           => 'INTEGER',
         '%^.*?INT.*$%i'                           => 'INTEGER',
         '%^.*?(?:CHAR|CLOB|TEXT).*$%i'            => 'TEXT',
         '%^.*?(?:CHAR|CLOB|TEXT).*$%i'            => 'TEXT',
         '%^.*?BLOB.*$%i'                          => 'BLOB',
         '%^.*?BLOB.*$%i'                          => 'BLOB',
@@ -44,22 +32,17 @@ class Sqlite
 
 
     /**
     /**
      * Подстановка типов полей для карты БД
      * Подстановка типов полей для карты БД
-     * @var array
      */
      */
-    protected $types = [
+    protected array $types = [
         'boolean' => 'b',
         'boolean' => 'b',
         'integer' => 'i',
         'integer' => 'i',
         'real'    => 'f',
         'real'    => 'f',
         'numeric' => 'f',
         'numeric' => 'f',
     ];
     ];
 
 
-    public function __construct(DB $db, string $prefix)
+    public function __construct(protected DB $db, protected string $dbPrefix)
     {
     {
-        $this->db = $db;
-
-        $this->nameCheck($prefix);
-
-        $this->dbPrefix = $prefix;
+        $this->nameCheck($dbPrefix);
     }
     }
 
 
     /**
     /**
@@ -508,7 +491,7 @@ class Sqlite
     /**
     /**
      * Добавляет поле в таблицу
      * Добавляет поле в таблицу
      */
      */
-    public function addField(string $table, string $field, string $type, bool $allowNull, /* mixed */ $default = null, string $collate = null, string $after = null): bool
+    public function addField(string $table, string $field, string $type, bool $allowNull, mixed $default = null, string $collate = null, string $after = null): bool
     {
     {
         $table = $this->tName($table);
         $table = $this->tName($table);
 
 
@@ -524,7 +507,7 @@ class Sqlite
     /**
     /**
      * Модифицирует поле в таблице
      * Модифицирует поле в таблице
      */
      */
-    public function alterField(string $table, string $field, string $type, bool $allowNull, /* mixed */ $default = null, string $collate = null, string $after = null): bool
+    public function alterField(string $table, string $field, string $type, bool $allowNull, mixed $default = null, string $collate = null, string $after = null): bool
     {
     {
         $this->nameCheck($field);
         $this->nameCheck($field);
 
 

+ 2 - 5
app/Core/DB/SqliteStatement.php

@@ -33,10 +33,7 @@ class SqliteStatement extends AbstractStatement
      *   ... (это те типы, которые прописаны в CREATE TABLE и полученные после перекодировки из {driver}::bTypeRepl)
      *   ... (это те типы, которые прописаны в CREATE TABLE и полученные после перекодировки из {driver}::bTypeRepl)
      */
      */
 
 
-    /**
-     * @var array
-     */
-    protected $nativeTypeRepl = [
+    protected array $nativeTypeRepl = [
         'integer' => self::INTEGER,
         'integer' => self::INTEGER,
         'double'  => self::FLOAT,
         'double'  => self::FLOAT,
     ];
     ];
@@ -81,7 +78,7 @@ class SqliteStatement extends AbstractStatement
         return $this->columnsType;
         return $this->columnsType;
     }
     }
 
 
-    protected function convToBoolean(/* mixed */ $value): bool
+    protected function convToBoolean(mixed $value): bool
     {
     {
         return (bool) $value;
         return (bool) $value;
     }
     }

+ 6 - 15
app/Core/ErrorHandler.php

@@ -16,35 +16,27 @@ use Throwable;
 
 
 class ErrorHandler
 class ErrorHandler
 {
 {
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
+    protected Container $c;
 
 
     /**
     /**
      * Уровень буфера вывода на котором работает обработчик
      * Уровень буфера вывода на котором работает обработчик
-     * @var int
      */
      */
-    protected $obLevel;
+    protected int $obLevel;
 
 
     /**
     /**
      * Описание ошибки
      * Описание ошибки
-     * @var array
      */
      */
-    protected $error;
+    protected ?array $error = null;
 
 
     /**
     /**
      * Скрываемая часть пути до файла
      * Скрываемая часть пути до файла
-     * @var string
      */
      */
-    protected $hidePath;
+    protected string $hidePath;
 
 
     /**
     /**
      * Список ошибок
      * Список ошибок
-     * @var array
      */
      */
-    protected $type = [
+    protected array $type = [
         0                    => ['OTHER_ERROR',         'error'],
         0                    => ['OTHER_ERROR',         'error'],
         \E_ERROR             => ['E_ERROR',             'error'],
         \E_ERROR             => ['E_ERROR',             'error'],
         \E_WARNING           => ['E_WARNING',           'warning'],
         \E_WARNING           => ['E_WARNING',           'warning'],
@@ -65,9 +57,8 @@ class ErrorHandler
 
 
     /**
     /**
      * Уровень ошибок только для логирования
      * Уровень ошибок только для логирования
-     * @var int
      */
      */
-    protected $logOnly = 0;
+    protected int $logOnly = 0;
 
 
     public function __construct()
     public function __construct()
     {
     {

+ 7 - 39
app/Core/File.php

@@ -18,63 +18,35 @@ class File
 {
 {
     /**
     /**
      * Текст ошибки
      * Текст ошибки
-     * @var null|string
      */
      */
-    protected $error;
-
-    /**
-     * Путь до файла
-     * @var null|string
-     */
-    protected $path;
+    protected ?string $error = null;
 
 
     /**
     /**
      * Содержимое файла
      * Содержимое файла
-     * @var null|string
-     */
-    protected $data;
-
-    /**
-     * Оригинальное имя файла без расширения
-     * @var null|string
      */
      */
-    protected $name;
-
-    /**
-     * Оригинальное расширение файла
-     * @var null|string
-     */
-    protected $ext;
+    protected ?string $data;
 
 
     /**
     /**
      * Размер оригинального файла
      * Размер оригинального файла
      */
      */
-    protected $size;
+    protected int|false $size;
 
 
     /**
     /**
      * Флаг автопереименования файла
      * Флаг автопереименования файла
-     * @var bool
      */
      */
-    protected $rename = false;
+    protected bool $rename = false;
 
 
     /**
     /**
      * Флаг перезаписи файла
      * Флаг перезаписи файла
-     * @var bool
      */
      */
-    protected $rewrite = false;
+    protected bool $rewrite = false;
 
 
     /**
     /**
      * Паттерн для pathinfo
      * Паттерн для pathinfo
-     * @var string
-     */
-    protected $pattern = '%^(?!.*?\.\.)([\w.\x5C/:-]*[\x5C/])?(\*|[\w.-]+)\.(\*|[a-z\d]+)$%iD';
-
-    /**
-     * @var Files
      */
      */
-    protected $files;
+    protected string $pattern = '%^(?!.*?\.\.)([\w.\x5C/:-]*[\x5C/])?(\*|[\w.-]+)\.(\*|[a-z\d]+)$%iD';
 
 
-    public function __construct(string $path, string $name, string $ext, Files $files)
+    public function __construct(protected string $path, protected string $name, protected string $ext, protected Files $files)
     {
     {
         if ($files->isBadPath($path)) {
         if ($files->isBadPath($path)) {
             throw new FileException('Bad path to file');
             throw new FileException('Bad path to file');
@@ -86,10 +58,6 @@ class File
             throw new FileException('File can not be read');
             throw new FileException('File can not be read');
         }
         }
 
 
-        $this->files = $files;
-        $this->path  = $path;
-        $this->name  = $name;
-        $this->ext   = $ext;
         $this->data  = null;
         $this->data  = null;
         $this->size  = \is_string($this->data) ? \strlen($this->data) : \filesize($path);
         $this->size  = \is_string($this->data) ? \strlen($this->data) : \filesize($path);
 
 

+ 12 - 35
app/Core/Files.php

@@ -20,53 +20,35 @@ use RuntimeException;
 
 
 class Files
 class Files
 {
 {
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
-
     /**
     /**
      * Максимальный размер для картинок
      * Максимальный размер для картинок
-     * @var int
      */
      */
-    protected $maxImgSize;
+    protected int $maxImgSize;
 
 
     /**
     /**
      * Максимальный размер для файлов
      * Максимальный размер для файлов
-     * @var int
      */
      */
-    protected $maxFileSize;
+    protected int $maxFileSize;
 
 
     /**
     /**
      * Максимальный число пикселей
      * Максимальный число пикселей
-     * @var int
      */
      */
-    protected $maxPixels;
+    protected int $maxPixels;
 
 
     /**
     /**
      * Текст ошибки
      * Текст ошибки
-     * @var null|string
      */
      */
-    protected $error;
+    protected ?string $error = null;
 
 
     /**
     /**
      * Класс обработки изображений
      * Класс обработки изображений
-     * @var DefaultDriver
      */
      */
-    protected $imageDriver;
-
-    /**
-     * Список имён драйверов
-     * @var array
-     */
-    protected $imageDrivers;
+    protected ?DefaultDriver $imageDriver = null;
 
 
     /**
     /**
      * Список mime типов считающихся картинками
      * Список mime типов считающихся картинками
-     * @var array
      */
      */
-    protected $imageType = [
+    protected array $imageType = [
         'image/gif'  => 'gif',
         'image/gif'  => 'gif',
         'image/jpeg' => 'jpg',
         'image/jpeg' => 'jpg',
         'image/png'  => 'png',
         'image/png'  => 'png',
@@ -79,16 +61,14 @@ class Files
 
 
     /**
     /**
      * Список единиц измерения
      * Список единиц измерения
-     * @var string
      */
      */
-    protected $units = 'BKMGTPEZY';
+    protected string $units = 'BKMGTPEZY';
 
 
     /**
     /**
      * Допустимые расширения файлов для mime типов
      * Допустимые расширения файлов для mime типов
      * http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
      * http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
-     * @var array
      */
      */
-    protected $mimeToExt = [
+    protected array $mimeToExt = [
         'application/andrew-inset' => 'ez',
         'application/andrew-inset' => 'ez',
         'application/applixware' => 'aw',
         'application/applixware' => 'aw',
         'application/atom+xml' => 'atom',
         'application/atom+xml' => 'atom',
@@ -861,11 +841,8 @@ class Files
         'image/avif' => 'avif',
         'image/avif' => 'avif',
     ];
     ];
 
 
-    public function __construct(/* string|int */ $maxFileSize, /* string|int */ $maxImgSize, array $imageDrivers, Container $c)
+    public function __construct(int|string $maxFileSize, int|string $maxImgSize, protected array $imageDrivers, protected Container $c)
     {
     {
-        $this->c            = $c;
-        $this->imageDrivers = $imageDrivers;
-
         $init = \min(
         $init = \min(
             \PHP_INT_MAX,
             \PHP_INT_MAX,
             $this->size(\ini_get('upload_max_filesize')),
             $this->size(\ini_get('upload_max_filesize')),
@@ -924,7 +901,7 @@ class Files
      * Переводит объем информации из одних единиц в другие
      * Переводит объем информации из одних единиц в другие
      * кило = 1024, а не 1000
      * кило = 1024, а не 1000
      */
      */
-    public function size(/* int|float|string */ $value, string $to = null): int
+    public function size(int|float|string $value, string $to = null): int
     {
     {
         if (\is_string($value)) {
         if (\is_string($value)) {
             if (! \preg_match('%^([^a-z]+)([a-z]+)?$%i', \trim($value), $matches)) {
             if (! \preg_match('%^([^a-z]+)([a-z]+)?$%i', \trim($value), $matches)) {
@@ -975,7 +952,7 @@ class Files
     /**
     /**
      * Определяет расширение картинки по содержимому файла
      * Определяет расширение картинки по содержимому файла
      */
      */
-    public function imageExt(/* mixed */ $file): ?string
+    public function imageExt(mixed $file): ?string
     {
     {
         if ($file instanceof Image) {
         if ($file instanceof Image) {
             return $file->ext();
             return $file->ext();
@@ -1011,7 +988,7 @@ class Files
     /**
     /**
      * Получает файл(ы) из формы
      * Получает файл(ы) из формы
      */
      */
-    public function upload(array $file) /* : mixed */
+    public function upload(array $file): mixed
     {
     {
         $this->error = null;
         $this->error = null;
 
 

+ 11 - 14
app/Core/Func.php

@@ -15,33 +15,23 @@ use function \ForkBB\__;
 
 
 class Func
 class Func
 {
 {
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
-
     /**
     /**
      * Список доступных стилей
      * Список доступных стилей
-     * @var array
      */
      */
-    protected $styles;
+    protected ?array $styles = null;
 
 
     /**
     /**
      * Список доступных языков
      * Список доступных языков
-     * @var array
      */
      */
-    protected $langs;
+    protected ?array $langs = null;
 
 
     /**
     /**
      * Список имен доступных языков
      * Список имен доступных языков
-     * @var array
      */
      */
-    protected $nameLangs;
+    protected ?array $nameLangs = null;
 
 
-    public function __construct(Container $container)
+    public function __construct(protected Container $c)
     {
     {
-        $this->c = $container;
     }
     }
 
 
     /**
     /**
@@ -75,10 +65,13 @@ class Func
     {
     {
         if (! \is_array($this->nameLangs)) {
         if (! \is_array($this->nameLangs)) {
             $langs = $this->getLangs();
             $langs = $this->getLangs();
+
             foreach ($langs as &$value) {
             foreach ($langs as &$value) {
                 $value = include "{$this->c->DIR_LANG}/{$value}/name.php";
                 $value = include "{$this->c->DIR_LANG}/{$value}/name.php";
             }
             }
+
             unset($value);
             unset($value);
+
             $this->nameLangs = $langs;
             $this->nameLangs = $langs;
         }
         }
 
 
@@ -105,6 +98,7 @@ class Func
                     $result[$entry] = $entry;
                     $result[$entry] = $entry;
                 }
                 }
             }
             }
+
             \closedir($dh);
             \closedir($dh);
             \asort($result, \SORT_NATURAL);
             \asort($result, \SORT_NATURAL);
         }
         }
@@ -232,6 +226,7 @@ class Func
 
 
         foreach (\explode(',', $str) as $step) {
         foreach (\explode(',', $str) as $step) {
             $dsr = \explode(';', $step, 2);
             $dsr = \explode(';', $step, 2);
+
             if (
             if (
                 isset($dsr[1])) {
                 isset($dsr[1])) {
                 $q = \trim(\ltrim(\ltrim($dsr[1], 'q '), '='));
                 $q = \trim(\ltrim(\ltrim($dsr[1], 'q '), '='));
@@ -248,10 +243,12 @@ class Func
             }
             }
 
 
             $l = \trim($dsr[0]);
             $l = \trim($dsr[0]);
+
             if (\preg_match('%^[[:alpha:]]{1,8}(?:-[[:alnum:]]{1,8})?$%', $l)) {
             if (\preg_match('%^[[:alpha:]]{1,8}(?:-[[:alnum:]]{1,8})?$%', $l)) {
                 $result[$l] = $q;
                 $result[$l] = $q;
             }
             }
         }
         }
+
         \arsort($result, \SORT_NUMERIC);
         \arsort($result, \SORT_NUMERIC);
 
 
         return \array_keys($result);
         return \array_keys($result);

+ 3 - 2
app/Core/HTMLCleaner.php

@@ -15,8 +15,9 @@ use RuntimeException;
 
 
 class HTMLCleaner extends Jevix
 class HTMLCleaner extends Jevix
 {
 {
-    protected $hConfigFile;
-    protected $hConfigName;
+    protected string $hConfigFile;
+
+    protected ?string $hConfigName = null;
 
 
     public function __construct(string $file)
     public function __construct(string $file)
     {
     {

+ 4 - 8
app/Core/Image.php

@@ -20,27 +20,23 @@ class Image extends File
 {
 {
     /**
     /**
      * Изображение
      * Изображение
-     * @var mixed
      */
      */
-    protected $image;
+    protected mixed $image;
 
 
     /**
     /**
      * Класс обработки изображений
      * Класс обработки изображений
-     * @var DefaultDriver
      */
      */
-    protected $imgDriver;
+    protected DefaultDriver $imgDriver;
 
 
     /**
     /**
      * Качество изображения
      * Качество изображения
-     * @var int
      */
      */
-    protected $quality = 100;
+    protected int $quality = 100;
 
 
     /**
     /**
      * Паттерн для pathinfo
      * Паттерн для pathinfo
-     * @var string
      */
      */
-    protected $pattern = '%^(?!.*?\.\.)([\w.\x5C/:-]*[\x5C/])?(\*|[\w.-]+)\.(\*|[a-z\d]+|\([a-z\d]+(?:\|[a-z\d]+)*\))$%iD';
+    protected string $pattern = '%^(?!.*?\.\.)([\w.\x5C/:-]*[\x5C/])?(\*|[\w.-]+)\.(\*|[a-z\d]+|\([a-z\d]+(?:\|[a-z\d]+)*\))$%iD';
 
 
     public function __construct(string $path, string $name, string $ext, Files $files)
     public function __construct(string $path, string $name, string $ext, Files $files)
     {
     {

+ 7 - 16
app/Core/Image/DefaultDriver.php

@@ -17,20 +17,11 @@ class DefaultDriver
 {
 {
     const DEFAULT = true;
     const DEFAULT = true;
 
 
-    /**
-     * @var bool
-     */
-    protected $ready;
+    protected bool $ready = false;
 
 
-    /**
-     * @var Files
-     */
-    protected $files;
-
-    public function __construct(Files $files)
+    public function __construct(protected Files $files)
     {
     {
         $this->ready = true;
         $this->ready = true;
-        $this->files = $files;
     }
     }
 
 
     public function ready(): bool
     public function ready(): bool
@@ -38,27 +29,27 @@ class DefaultDriver
         return $this->ready;
         return $this->ready;
     }
     }
 
 
-    public function readFromStr(string $data) /* : mixed|false */
+    public function readFromStr(string $data): mixed
     {
     {
         return false;
         return false;
     }
     }
 
 
-    public function readFromPath(string $path) /* : mixed|false */
+    public function readFromPath(string $path): mixed
     {
     {
         return false;
         return false;
     }
     }
 
 
-    public function writeToPath(/* mixed */ $image, string $path, int $quality): ?bool
+    public function writeToPath(mixed $image, string $path, int $quality): ?bool
     {
     {
         return null;
         return null;
     }
     }
 
 
-    public function resize(/* mixed */ $image, int $maxW, int $maxH) /* : mixed */
+    public function resize(mixed $image, int $maxW, int $maxH): mixed
     {
     {
         return $image;
         return $image;
     }
     }
 
 
-    public function destroy(/* mixed */ $image): void
+    public function destroy(mixed $image): void
     {
     {
     }
     }
 }
 }

+ 6 - 6
app/Core/Image/GDDriver.php

@@ -25,12 +25,12 @@ class GDDriver extends DefaultDriver
         $this->ready = \extension_loaded('gd') && \function_exists('\\imagecreatetruecolor');
         $this->ready = \extension_loaded('gd') && \function_exists('\\imagecreatetruecolor');
     }
     }
 
 
-    public function readFromStr(string $data) /* : mixed|false */
+    public function readFromStr(string $data): mixed
     {
     {
         return $this->tuning($this->ready ? \imagecreatefromstring($data) : false);
         return $this->tuning($this->ready ? \imagecreatefromstring($data) : false);
     }
     }
 
 
-    public function readFromPath(string $path) /* : mixed|false */
+    public function readFromPath(string $path): mixed
     {
     {
         if (
         if (
             ! $this->ready
             ! $this->ready
@@ -42,7 +42,7 @@ class GDDriver extends DefaultDriver
         }
         }
     }
     }
 
 
-    protected function tuning(/* mixed */ $image) /* : mixed */
+    protected function tuning(mixed $image): mixed
     {
     {
         if (
         if (
             false !== $image
             false !== $image
@@ -57,7 +57,7 @@ class GDDriver extends DefaultDriver
         }
         }
     }
     }
 
 
-    public function writeToPath(/* mixed */ $image, string $path, int $quality): ?bool
+    public function writeToPath(mixed $image, string $path, int $quality): ?bool
     {
     {
         $args = [$image, $path];
         $args = [$image, $path];
         $type = \pathinfo($path, \PATHINFO_EXTENSION);
         $type = \pathinfo($path, \PATHINFO_EXTENSION);
@@ -92,7 +92,7 @@ class GDDriver extends DefaultDriver
         }
         }
     }
     }
 
 
-    public function resize(/* mixed */ $image, int $maxW, int $maxH) /* : mixed */
+    public function resize(mixed $image, int $maxW, int $maxH): mixed
     {
     {
         if (! $this->ready) {
         if (! $this->ready) {
             throw new FileException('GD library not enabled');
             throw new FileException('GD library not enabled');
@@ -140,7 +140,7 @@ class GDDriver extends DefaultDriver
         return $result;
         return $result;
     }
     }
 
 
-    public function destroy(/* mixed */ $image): void
+    public function destroy(mixed $image): void
     {
     {
         if (\is_resource($image)) {
         if (\is_resource($image)) {
             \imagedestroy($image);
             \imagedestroy($image);

+ 5 - 5
app/Core/Image/ImagickDriver.php

@@ -27,7 +27,7 @@ class ImagickDriver extends DefaultDriver
         $this->ready = \extension_loaded('imagick') && \class_exists('\\Imagick');
         $this->ready = \extension_loaded('imagick') && \class_exists('\\Imagick');
     }
     }
 
 
-    public function readFromStr(string $data) /* : mixed|false */
+    public function readFromStr(string $data): mixed
     {
     {
         if ($this->ready) {
         if ($this->ready) {
             try {
             try {
@@ -43,7 +43,7 @@ class ImagickDriver extends DefaultDriver
         return false;
         return false;
     }
     }
 
 
-    public function readFromPath(string $path) /* : mixed|false */
+    public function readFromPath(string $path): mixed
     {
     {
         if (
         if (
             ! $this->ready
             ! $this->ready
@@ -59,7 +59,7 @@ class ImagickDriver extends DefaultDriver
         }
         }
     }
     }
 
 
-    public function writeToPath(/* mixed */ $imagick, string $path, int $quality): ?bool
+    public function writeToPath(mixed $imagick, string $path, int $quality): ?bool
     {
     {
         if (! $this->ready) {
         if (! $this->ready) {
             return null;
             return null;
@@ -83,7 +83,7 @@ class ImagickDriver extends DefaultDriver
         }
         }
     }
     }
 
 
-    public function resize(/* mixed */ $imagick, int $maxW, int $maxH) /* : mixed */
+    public function resize(mixed $imagick, int $maxW, int $maxH): mixed
     {
     {
         if (! $this->ready) {
         if (! $this->ready) {
             throw new FileException('ImageMagick library not enabled');
             throw new FileException('ImageMagick library not enabled');
@@ -124,7 +124,7 @@ class ImagickDriver extends DefaultDriver
         }
         }
     }
     }
 
 
-    public function destroy(/* mixed */ $imagick): void
+    public function destroy(mixed $imagick): void
     {
     {
     }
     }
 }
 }

+ 14 - 27
app/Core/Lang.php

@@ -11,50 +11,38 @@ declare(strict_types=1);
 namespace ForkBB\Core;
 namespace ForkBB\Core;
 
 
 use ForkBB\Core\Container;
 use ForkBB\Core\Container;
+use Psr\SimpleCache\CacheInterface;
 use InvalidArgumentException;
 use InvalidArgumentException;
 use RuntimeException;
 use RuntimeException;
 
 
 class Lang
 class Lang
 {
 {
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
-
-    /**
-     * @var Psr\SimpleCache\CacheInterface
-     */
-    protected $cache;
+    protected CacheInterface $cache;
 
 
     /**
     /**
      * Массив переводов
      * Массив переводов
-     * @var array
      */
      */
-    protected $tr = [];
+    protected array $tr = [];
 
 
     /**
     /**
      * Загруженные переводы
      * Загруженные переводы
-     * @var array
      */
      */
-    protected $loaded = [];
+    protected array $loaded = [];
 
 
     /**
     /**
      * Порядок перебора языка
      * Порядок перебора языка
-     * @var array
      */
      */
-    protected $langOrder = [];
+    protected array $langOrder = [];
 
 
     /**
     /**
-     * @var string
+     * Имя текущего загружаемого языкового файла в формате lang/name.po
      */
      */
-    protected $cur;
+    protected string $cur;
 
 
     /**
     /**
      * Список операторов для вычисления Plural Forms
      * Список операторов для вычисления Plural Forms
-     * @var array
      */
      */
-    protected $oprtrs = [
+    protected array $oprtrs = [
         '**'  => [23, true , 2], // возведение в степень
         '**'  => [23, true , 2], // возведение в степень
         '!'   => [20, false, 1],
         '!'   => [20, false, 1],
         '*'   => [19, false, 2],
         '*'   => [19, false, 2],
@@ -88,20 +76,19 @@ class Lang
     ];
     ];
 
 
     /**
     /**
-     * @var array
+     * Список преобразованных формул Plural Forms
      */
      */
-    protected $pluralCashe = [];
+    protected array $pluralCashe = [];
 
 
-    public function __construct(Container $container)
+    public function __construct(protected Container $c)
     {
     {
-        $this->c     = $container;
-        $this->cache = $container->Cache;
+        $this->cache = $c->Cache;
     }
     }
 
 
     /**
     /**
      * Ищет сообщение в загруженных переводах
      * Ищет сообщение в загруженных переводах
      */
      */
-    public function get(string $message, string $lang = null) /* : null|string|array */
+    public function get(string $message, string $lang = null): null|string|array
     {
     {
         if (
         if (
             null !== $lang
             null !== $lang
@@ -459,7 +446,7 @@ class Lang
     /**
     /**
      * Вычисляет выражение представленное токенами в postfix записи и переменными
      * Вычисляет выражение представленное токенами в postfix записи и переменными
      */
      */
-    protected function calcPostfix(array $postfixList, array $vars = []) /* : mixed */
+    protected function calcPostfix(array $postfixList, array $vars = []): mixed
     {
     {
         foreach ($postfixList as $token) {
         foreach ($postfixList as $token) {
             if (\is_string($token)) {
             if (\is_string($token)) {

+ 5 - 12
app/Core/Log.php

@@ -23,21 +23,14 @@ class Log implements LoggerInterface
 {
 {
     const JSON_OPTIONS = \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE | \JSON_INVALID_UTF8_SUBSTITUTE | \JSON_THROW_ON_ERROR;
     const JSON_OPTIONS = \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE | \JSON_INVALID_UTF8_SUBSTITUTE | \JSON_THROW_ON_ERROR;
 
 
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
-
-    protected $path;
-    protected $lineFormat;
-    protected $timeFormat;
+    protected string $path;
+    protected string $lineFormat;
+    protected string $timeFormat;
     protected $resource;
     protected $resource;
-    protected $hidePath;
+    protected string $hidePath;
 
 
-    public function __construct(array $config, Container $c)
+    public function __construct(array $config, protected Container $c)
     {
     {
-        $this->c          = $c;
         $this->path       = $config['path']       ?? __DIR__ . '/../log/{Y-m-d}.log';
         $this->path       = $config['path']       ?? __DIR__ . '/../log/{Y-m-d}.log';
         $this->lineFormat = $config['lineFormat'] ?? "%datetime% [%level_name%] %message%\t%context%\n";
         $this->lineFormat = $config['lineFormat'] ?? "%datetime% [%level_name%] %message%\t%context%\n";
         $this->timeFormat = $config['timeFormat'] ?? 'Y-m-d H:i:s';
         $this->timeFormat = $config['timeFormat'] ?? 'Y-m-d H:i:s';

+ 10 - 13
app/Core/LogViewer.php

@@ -20,21 +20,19 @@ class LogViewer
 {
 {
     const CACHE_KEY = 'logs_info';
     const CACHE_KEY = 'logs_info';
 
 
-    protected $cache;
-    protected $dir;
-    protected $namePattern;
-    protected $linePattern;
-    protected $typePattern;
-    protected $resource;
-    protected $fileList;
-    protected $hashList;
-    protected $replName = [
+    protected string $dir;
+    protected string $namePattern;
+    protected string $linePattern;
+    protected string $typePattern;
+    protected array $fileList;
+    protected array $hashList;
+    protected array $replName = [
         '.' => '\\.',
         '.' => '\\.',
         '*' => '.*',
         '*' => '.*',
         '?' => '.',
         '?' => '.',
         '%' => '\\%',
         '%' => '\\%',
     ];
     ];
-    protected $replLine = [
+    protected array $replLine = [
         '['            => '\\[',
         '['            => '\\[',
         ']'            => '\\]',
         ']'            => '\\]',
         '%datetime%'   => '(?P<datetime>(?=\S)[a-z0-9,\.:/ -]+)',
         '%datetime%'   => '(?P<datetime>(?=\S)[a-z0-9,\.:/ -]+)',
@@ -43,9 +41,8 @@ class LogViewer
         '%context%'    => '(?P<context>(?:\[.*?\]|{.*?}))',
         '%context%'    => '(?P<context>(?:\[.*?\]|{.*?}))',
     ];
     ];
 
 
-    public function __construct(array $config, CacheInterface $cache)
+    public function __construct(array $config, protected CacheInterface $cache)
     {
     {
-        $this->cache       = $cache;
         $this->dir         = \rtrim(\realpath($config['dir'] ?? __DIR__ . '/../log'), '\\/');
         $this->dir         = \rtrim(\realpath($config['dir'] ?? __DIR__ . '/../log'), '\\/');
         $this->namePattern = $this->toNamePattern($config['pattern'] ?? '*.log');
         $this->namePattern = $this->toNamePattern($config['pattern'] ?? '*.log');
         $this->fileList    = $this->getFileList();
         $this->fileList    = $this->getFileList();
@@ -53,7 +50,7 @@ class LogViewer
         $this->setPatterns($config['lineFormat'] ?? "%datetime% [%level_name%] %message%\t%context%\n");
         $this->setPatterns($config['lineFormat'] ?? "%datetime% [%level_name%] %message%\t%context%\n");
     }
     }
 
 
-    protected function setPatterns($format): void
+    protected function setPatterns(string $format): void
     {
     {
         $pos = \strpos($format, '%level_name%');
         $pos = \strpos($format, '%level_name%');
 
 

+ 15 - 74
app/Core/Mail.php

@@ -18,79 +18,22 @@ use function \ForkBB\e;
 
 
 class Mail
 class Mail
 {
 {
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
-
-    /**
-     * @var string
-     */
-    protected $folder;
-
-    /**
-     * @var string
-     */
-    protected $language;
-
-    /**
-     * @var string
-     */
-    protected $from;
-
-    /**
-     * @var array
-     */
-    protected $to = [];
-
-    /**
-     * @var array
-     */
-    protected $headers = [];
-
-    /**
-     * @var string
-     */
-    protected $message;
-
-    /**
-     * @var array
-     */
-    protected $smtp;
-
-    /**
-     * @var string
-     */
-    protected $EOL;
-
-    /**
-     * @var Resource
-     */
+    protected string $folder;
+    protected string $language;
+    protected string $from;
+    protected array $to = [];
+    protected array $headers = [];
+    protected string $message;
+    protected array $smtp;
+    protected string $EOL;
     protected $connect;
     protected $connect;
-
-    /**
-     * var int
-     */
-    protected $auth = 0;
-
-    /**
-     * var int
-     */
-    protected $maxRecipients = 1;
-
-    /**
-     * @var array
-     */
-    protected $tplHeaders = [
+    protected int $auth = 0;
+    protected int $maxRecipients = 1;
+    protected array $tplHeaders = [
         'Subject'      => true,
         'Subject'      => true,
         'Content-Type' => true,
         'Content-Type' => true,
     ];
     ];
-
-    /**
-     * @var string
-     */
-    protected $response;
+    protected string $response;
 
 
     public function __construct(
     public function __construct(
         /* string */ $host,
         /* string */ $host,
@@ -99,10 +42,8 @@ class Mail
         /* string */ $pass,
         /* string */ $pass,
         /* bool */ $ssl,
         /* bool */ $ssl,
         /* string */ $eol,
         /* string */ $eol,
-        Container $c
+        protected Container $c
     ) {
     ) {
-        $this->c = $c;
-
         if (
         if (
             \is_string($host)
             \is_string($host)
             && \strlen(\trim($host)) > 0
             && \strlen(\trim($host)) > 0
@@ -134,7 +75,7 @@ class Mail
     /**
     /**
      * Валидация email
      * Валидация email
      */
      */
-    public function valid(/* mixed */ $email, bool $strict = false, bool $idna = false) /* : string|false */
+    public function valid(mixed $email, bool $strict = false, bool $idna = false): string|false
     {
     {
         if (
         if (
             ! \is_string($email)
             ! \is_string($email)
@@ -252,7 +193,7 @@ class Mail
     /**
     /**
      * Задает заголовок To
      * Задает заголовок To
      */
      */
-    public function setTo(/* array|string */ $email, string $name = null): Mail
+    public function setTo(array|string $email, string $name = null): Mail
     {
     {
         $this->to = [];
         $this->to = [];
 
 

+ 1 - 8
app/Core/Parser.php

@@ -15,15 +15,8 @@ use ForkBB\Core\Container;
 
 
 class Parser extends Parserus
 class Parser extends Parserus
 {
 {
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
-
-    public function __construct(int $flag, Container $container)
+    public function __construct(int $flag, protected Container $c)
     {
     {
-        $this->c = $container;
         parent::__construct($flag);
         parent::__construct($flag);
         $this->init();
         $this->init();
     }
     }

+ 14 - 35
app/Core/Router.php

@@ -26,80 +26,59 @@ class Router
 
 
     /**
     /**
      * Массив постоянных маршрутов
      * Массив постоянных маршрутов
-     * @var array
      */
      */
-    protected $statical = [];
+    protected array $statical = [];
 
 
     /**
     /**
      * Массив динамических маршрутов
      * Массив динамических маршрутов
-     * @var array
      */
      */
-    protected $dynamic = [];
+    protected array $dynamic = [];
 
 
     /**
     /**
      * Список методов доступа
      * Список методов доступа
-     * @var array
      */
      */
-    protected $methods = [];
+    protected array $methods = [];
 
 
     /**
     /**
      * Массив для построения ссылок
      * Массив для построения ссылок
-     * @var array
      */
      */
-    protected $links = [];
-
-    /**
-     * Базовый url сайта
-     * @var string
-     */
-    protected $baseUrl;
+    protected array $links = [];
 
 
     /**
     /**
      * Host сайта
      * Host сайта
-     * @var string
      */
      */
-    protected $host;
+    protected string $host;
 
 
     /**
     /**
      * Префикс uri
      * Префикс uri
-     * @var string
      */
      */
-    protected $prefix;
+    protected string $prefix;
 
 
     /**
     /**
      * Длина префикса в байтах
      * Длина префикса в байтах
-     * @var int
      */
      */
-    protected $length;
+    protected int $length;
 
 
-    protected $subSearch = [
+    protected array $subSearch = [
         '/',
         '/',
         '\\',
         '\\',
     ];
     ];
-
-    protected $subRepl = [
+    protected array $subRepl = [
         '(_slash_)',
         '(_slash_)',
         '(_backslash_)',
         '(_backslash_)',
     ];
     ];
 
 
-    /**
-     * @var Csrf
-     */
-    protected $csrf;
-
-    public function __construct(string $base, Csrf $csrf)
+    public function __construct(protected string $baseUrl, protected Csrf $csrf)
     {
     {
-        $this->baseUrl = $base;
-        $this->csrf    = $csrf;
-        $this->host    = \parse_url($base, \PHP_URL_HOST);
-        $this->prefix  = \parse_url($base, \PHP_URL_PATH) ?? '';
+        $this->host    = \parse_url($baseUrl, \PHP_URL_HOST);
+        $this->prefix  = \parse_url($baseUrl, \PHP_URL_PATH) ?? '';
         $this->length  = \strlen($this->prefix);
         $this->length  = \strlen($this->prefix);
     }
     }
 
 
     /**
     /**
      * Проверка url на принадлежность форуму
      * Проверка url на принадлежность форуму
      */
      */
-    public function validate(/* mixed */ $url, string $defMarker, array $defArgs = []): string
+    public function validate(mixed $url, string $defMarker, array $defArgs = []): string
     {
     {
         if (
         if (
             \is_string($url)
             \is_string($url)
@@ -310,7 +289,7 @@ class Router
     /**
     /**
      * Метод добавляет маршрут
      * Метод добавляет маршрут
      */
      */
-    public function add(/* array|string */ $method, string $route, string $handler, string $marker = null): void
+    public function add(array|string $method, string $route, string $handler, string $marker = null): void
     {
     {
         if (\is_array($method)) {
         if (\is_array($method)) {
             foreach ($method as $m) {
             foreach ($method as $m) {

+ 1 - 8
app/Core/RulesValidator.php

@@ -15,15 +15,8 @@ use RuntimeException;
 
 
 abstract class RulesValidator
 abstract class RulesValidator
 {
 {
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
-
-    public function __construct(Container $container)
+    public function __construct(protected Container $c)
     {
     {
-        $this->c = $container;
     }
     }
 
 
     /**
     /**

+ 4 - 15
app/Core/Secury.php

@@ -18,13 +18,7 @@ use InvalidArgumentException;
 
 
 class Secury
 class Secury
 {
 {
-    /**
-     * Algorithm and salt for hash_hmac
-     * @var array
-     */
-    protected $hmac;
-
-    public function __construct(array $hmac)
+    public function __construct(protected array $hmac)
     {
     {
         if (
         if (
             empty($hmac['salt'])
             empty($hmac['salt'])
@@ -36,8 +30,6 @@ class Secury
         if (! \in_array($hmac['algo'], \hash_hmac_algos(), true)) {
         if (! \in_array($hmac['algo'], \hash_hmac_algos(), true)) {
             throw new UnexpectedValueException('Algorithm not supported');
             throw new UnexpectedValueException('Algorithm not supported');
         }
         }
-
-        $this->hmac = $hmac;
     }
     }
 
 
     /**
     /**
@@ -51,11 +43,8 @@ class Secury
     /**
     /**
      * Обертка для hash_hmac
      * Обертка для hash_hmac
      */
      */
-    public function hmac(
-        string $data,
-        #[SensitiveParameter]
-        string $key
-    ): string {
+    public function hmac(string $data, #[SensitiveParameter] string $key): string
+    {
         if (empty($key)) {
         if (empty($key)) {
             throw new InvalidArgumentException('Key can not be empty');
             throw new InvalidArgumentException('Key can not be empty');
         }
         }
@@ -92,7 +81,7 @@ class Secury
      * For string: Replacing invalid UTF-8 characters and remove control characters
      * For string: Replacing invalid UTF-8 characters and remove control characters
      * For other scalar or null: unchanged
      * For other scalar or null: unchanged
      */
      */
-    public function replInvalidChars(/* mixed */ $data) /* : mixed */
+    public function replInvalidChars(mixed $data): mixed
     {
     {
         if (\is_array($data)) {
         if (\is_array($data)) {
             return \array_map([$this, 'replInvalidChars'], $data);
             return \array_map([$this, 'replInvalidChars'], $data);

+ 2 - 9
app/Core/Test.php

@@ -15,15 +15,8 @@ use ForkBB\Core\Validator;
 
 
 class Test
 class Test
 {
 {
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
-
-    public function __construct(Container $container)
+    public function __construct(protected Container $c)
     {
     {
-        $this->c = $container;
     }
     }
 
 
     public function beforeValidation(Validator $v): Validator
     public function beforeValidation(Validator $v): Validator
@@ -38,7 +31,7 @@ class Test
         return $v;
         return $v;
     }
     }
 
 
-    public function vTestCheck(Validator $v, /* mixed */ $value) /* : mixed */
+    public function vTestCheck(Validator $v, mixed $value): mixed
     {
     {
         if (null !== $value) {
         if (null !== $value) {
             $v->addError('The :alias contains an invalid value');
             $v->addError('The :alias contains an invalid value');

+ 37 - 56
app/Core/Validator.php

@@ -19,87 +19,68 @@ use function \ForkBB\__;
 
 
 class Validator
 class Validator
 {
 {
-    /**
-     * Контейнер
-     * @var Container
-     */
-    protected $c;
-
     /**
     /**
      * Массив валидаторов
      * Массив валидаторов
-     * @var array
      */
      */
-    protected $validators;
+    protected array $validators;
 
 
     /**
     /**
      * Массив правил для текущей проверки данных
      * Массив правил для текущей проверки данных
-     * @var array
      */
      */
-    protected $rules;
+    protected array $rules;
 
 
     /**
     /**
      * Массив результатов проверенных данных
      * Массив результатов проверенных данных
-     * @var array
      */
      */
-    protected $result;
+    protected array $result;
 
 
     /**
     /**
      * Массив дополнительных аргументов для валидаторов и конкретных полей/правил
      * Массив дополнительных аргументов для валидаторов и конкретных полей/правил
-     * @var array
      */
      */
-    protected $arguments;
+    protected array $arguments;
 
 
     /**
     /**
      * Массив сообщений об ошибках для конкретных полей/правил
      * Массив сообщений об ошибках для конкретных полей/правил
-     * @var array
      */
      */
-    protected $messages;
+    protected array $messages;
 
 
     /**
     /**
      * Массив псевдонимов имен полей для вывода в ошибках
      * Массив псевдонимов имен полей для вывода в ошибках
-     * @var array
      */
      */
-    protected $aliases;
+    protected array $aliases;
 
 
     /**
     /**
      * Массив ошибок валидации
      * Массив ошибок валидации
-     * @var array
      */
      */
-    protected $errors;
+    protected array $errors;
 
 
     /**
     /**
      * Массив имен полей для обработки
      * Массив имен полей для обработки
-     * @var array
      */
      */
-    protected $fields;
+    protected array $fields;
 
 
     /**
     /**
      * Массив состояний проверки полей
      * Массив состояний проверки полей
-     * @var array
      */
      */
-    protected $status;
+    protected array $status;
 
 
     /**
     /**
      * Массив входящих данных для обработки
      * Массив входящих данных для обработки
-     * @var array
      */
      */
-    protected $raw;
+    protected ?array $raw;
 
 
     /**
     /**
      * Данные для текущей обработки
      * Данные для текущей обработки
-     * @var array
      */
      */
-    protected $curData;
+    protected array $curData;
 
 
     /**
     /**
      * Флаг ошибки
      * Флаг ошибки
-     * @var ?bool
      */
      */
-    protected $error;
+    protected ?bool $error = null;
 
 
-    public function __construct(Container $container)
+    public function __construct(protected Container $c)
     {
     {
-        $this->c = $container;
         $this->reset();
         $this->reset();
     }
     }
 
 
@@ -286,7 +267,7 @@ class Validator
      * Проверяет поле согласно заданным правилам
      * Проверяет поле согласно заданным правилам
      * Возвращает значение запрашиваемого поля
      * Возвращает значение запрашиваемого поля
      */
      */
-    public function __get(string $field) /* : mixed */
+    public function __get(string $field): mixed
     {
     {
         if (isset($this->status[$field])) {
         if (isset($this->status[$field])) {
             return $this->result[$field];
             return $this->result[$field];
@@ -320,7 +301,7 @@ class Validator
     /**
     /**
      * Проверяет значение списком правил
      * Проверяет значение списком правил
      */
      */
-    protected function checkValue(/* mixed */ $value, array $rules, string $field) /* : mixed */
+    protected function checkValue(mixed $value, array $rules, string $field): mixed
     {
     {
         foreach ($rules as $validator => $attr) {
         foreach ($rules as $validator => $attr) {
             // данные для обработчика ошибок
             // данные для обработчика ошибок
@@ -346,7 +327,7 @@ class Validator
     /**
     /**
      * Добавляет ошибку
      * Добавляет ошибку
      */
      */
-    public function addError(/* string|array|null */ $error, string $type = 'v'): void
+    public function addError(string|array|null $error, string $type = 'v'): void
     {
     {
         if (empty($vars = \end($this->curData))) {
         if (empty($vars = \end($this->curData))) {
             throw new RuntimeException('The array of variables is empty');
             throw new RuntimeException('The array of variables is empty');
@@ -386,7 +367,7 @@ class Validator
     /**
     /**
      * Возвращает дополнительные аргументы
      * Возвращает дополнительные аргументы
      */
      */
-    protected function getArguments(string $field, string $rule) /* : mixed */
+    protected function getArguments(string $field, string $rule): mixed
     {
     {
         return $this->arguments["{$field}.{$rule}"] ?? $this->arguments[$field] ?? null;
         return $this->arguments["{$field}.{$rule}"] ?? $this->arguments[$field] ?? null;
     }
     }
@@ -461,7 +442,7 @@ class Validator
     /**
     /**
      * Проверяет переменную на отсутсвие содержимого
      * Проверяет переменную на отсутсвие содержимого
      */
      */
-    public function noValue(/* mixed */ $value, bool $withArray = false): bool
+    public function noValue(mixed $value, bool $withArray = false): bool
     {
     {
         if (null === $value) {
         if (null === $value) {
             return true;
             return true;
@@ -484,7 +465,7 @@ class Validator
      *
      *
      * @return mixed
      * @return mixed
      */
      */
-    protected function vAbsent(Validator $v, /* mixed */ $value, string $attr) /* : mixed */
+    protected function vAbsent(Validator $v, mixed $value, string $attr): mixed
     {
     {
         if (null === $value) {
         if (null === $value) {
             if (isset($attr[0])) {
             if (isset($attr[0])) {
@@ -497,7 +478,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vExist(Validator $v, /* mixed */ $value) /* : mixed */
+    protected function vExist(Validator $v, mixed $value): mixed
     {
     {
         if (null === $value) {
         if (null === $value) {
             $this->addError('The :alias not exist');
             $this->addError('The :alias not exist');
@@ -506,7 +487,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vRequired(Validator $v, /* mixed */ $value) /* : mixed */
+    protected function vRequired(Validator $v, mixed $value): mixed
     {
     {
         if ($this->noValue($value, true)) {
         if ($this->noValue($value, true)) {
             $this->addError('The :alias is required');
             $this->addError('The :alias is required');
@@ -517,7 +498,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vRequiredWith(Validator $v, /* mixed */ $value, string $attr) /* : mixed */
+    protected function vRequiredWith(Validator $v, mixed $value, string $attr): mixed
     {
     {
         foreach (\explode(',', $attr) as $field) {
         foreach (\explode(',', $attr) as $field) {
             if (null !== $this->__get($field)) {     // если есть хотя бы одно поле,
             if (null !== $this->__get($field)) {     // если есть хотя бы одно поле,
@@ -532,7 +513,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vString(Validator $v, /* mixed */ $value, string $attr): ?string
+    protected function vString(Validator $v, mixed $value, string $attr): ?string
     {
     {
         if (\is_string($value)) {
         if (\is_string($value)) {
             if (isset($attr[0])) {
             if (isset($attr[0])) {
@@ -584,7 +565,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vNumeric(Validator $v, /* mixed */ $value) /* : mixed */
+    protected function vNumeric(Validator $v, mixed $value): mixed
     {
     {
         if (\is_numeric($value)) {
         if (\is_numeric($value)) {
             $value += 0;
             $value += 0;
@@ -604,7 +585,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vInteger(Validator $v, /* mixed */ $value) /* : mixed */
+    protected function vInteger(Validator $v, mixed $value): mixed
     {
     {
         if (
         if (
             \is_numeric($value)
             \is_numeric($value)
@@ -627,7 +608,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vArray(Validator $v, $value, array $attr): ?array
+    protected function vArray(Validator $v, mixed $value, array $attr): ?array
     {
     {
         if (
         if (
             null !== $value
             null !== $value
@@ -691,7 +672,7 @@ class Validator
         }
         }
     }
     }
 
 
-    protected function vMin(Validator $v, /* mixed */ $value, string $attr) /* : mixed */
+    protected function vMin(Validator $v, mixed $value, string $attr): mixed
     {
     {
         if (! \preg_match('%^(-?\d+)(\s*bytes)?$%i', $attr, $matches)) {
         if (! \preg_match('%^(-?\d+)(\s*bytes)?$%i', $attr, $matches)) {
             throw new InvalidArgumentException('Expected number in attribute');
             throw new InvalidArgumentException('Expected number in attribute');
@@ -730,7 +711,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vMax(Validator $v, /* mixed */ $value, string $attr) /* : mixed */
+    protected function vMax(Validator $v, mixed $value, string $attr): mixed
     {
     {
         if (! \preg_match('%^(-?\d+)(\s*bytes)?$%i', $attr, $matches)) {
         if (! \preg_match('%^(-?\d+)(\s*bytes)?$%i', $attr, $matches)) {
             throw new InvalidArgumentException('Expected number in attribute');
             throw new InvalidArgumentException('Expected number in attribute');
@@ -785,7 +766,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vToken(Validator $v, /* mixed */ $value, string $attr, /* mixed */ $args): ?string
+    protected function vToken(Validator $v, mixed $value, string $attr, mixed $args): ?string
     {
     {
         if (! \is_array($args)) {
         if (! \is_array($args)) {
             $args = [];
             $args = [];
@@ -803,7 +784,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vCheckbox(Validator $v, /* mixed */ $value) /* : mixed */
+    protected function vCheckbox(Validator $v, mixed $value): mixed
     {
     {
         if (null === $value) {
         if (null === $value) {
             $this->addError(null);
             $this->addError(null);
@@ -820,7 +801,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vReferer(Validator $v, /* mixed */ $value, string $attr, /* mixed */ $args): string
+    protected function vReferer(Validator $v, mixed $value, string $attr, mixed $args): string
     {
     {
         if (! \is_array($args)) {
         if (! \is_array($args)) {
             $args = [];
             $args = [];
@@ -829,7 +810,7 @@ class Validator
         return $this->c->Router->validate($value, $attr, $args);
         return $this->c->Router->validate($value, $attr, $args);
     }
     }
 
 
-    protected function vSame(Validator $v, /* mixed */ $value, string $attr) /* : mixed */
+    protected function vSame(Validator $v, mixed $value, string $attr): mixed
     {
     {
         if (
         if (
             $this->getStatus($attr)
             $this->getStatus($attr)
@@ -857,7 +838,7 @@ class Validator
         return $this->vRegex($v, $value, '%[^\x20][\x20][^\x20]%');
         return $this->vRegex($v, $value, '%[^\x20][\x20][^\x20]%');
     }
     }
 
 
-    protected function vIn(Validator $v, /* mixed */ $value, /* string|array */ $attr) /* : mixed */
+    protected function vIn(Validator $v, mixed $value, string|array $attr): mixed
     {
     {
         if (! \is_scalar($value)) {
         if (! \is_scalar($value)) {
             $value = null;
             $value = null;
@@ -880,7 +861,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vNotIn(Validator $v, /* mixed */ $value, /* string|array */ $attr) /* : mixed */
+    protected function vNotIn(Validator $v, mixed $value, string|array $attr): mixed
     {
     {
         if (! \is_scalar($value)) {
         if (! \is_scalar($value)) {
             $value = null;
             $value = null;
@@ -904,7 +885,7 @@ class Validator
     }
     }
 
 
 
 
-    protected function vFile(Validator $v, /* mixed */ $value, string $attr) /* : mixed */
+    protected function vFile(Validator $v, mixed $value, string $attr): mixed
     {
     {
         if ($this->noValue($value, true)) {
         if ($this->noValue($value, true)) {
             $this->addError(null);
             $this->addError(null);
@@ -941,7 +922,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vImage(Validator $v, /* mixed */ $value, string $attr) /* : mixed */
+    protected function vImage(Validator $v, mixed $value, string $attr): mixed
     {
     {
         $value = $this->vFile($v, $value, $attr);
         $value = $this->vFile($v, $value, $attr);
 
 
@@ -965,7 +946,7 @@ class Validator
         return $value;
         return $value;
     }
     }
 
 
-    protected function vDate(Validator $v, /* mixed */ $value): ?string
+    protected function vDate(Validator $v, mixed $value): ?string
     {
     {
         if ($this->noValue($value)) {
         if ($this->noValue($value)) {
             $value = null;
             $value = null;

+ 1 - 1
app/Models/Pages/Admin/Install.php

@@ -20,7 +20,7 @@ use function \ForkBB\__;
 
 
 class Install extends Admin
 class Install extends Admin
 {
 {
-    const PHP_MIN    = '7.3.0';
+    const PHP_MIN    = '8.0.0';
     const MYSQL_MIN  = '5.5.3';
     const MYSQL_MIN  = '5.5.3';
     const SQLITE_MIN = '3.25.0';
     const SQLITE_MIN = '3.25.0';
     const PGSQL_MIN  = '10.0';
     const PGSQL_MIN  = '10.0';

+ 2 - 2
app/Models/Pages/Admin/Update.php

@@ -23,8 +23,8 @@ use function \ForkBB\__;
 
 
 class Update extends Admin
 class Update extends Admin
 {
 {
-    const PHP_MIN                    = '7.3.0';
-    const REV_MIN_FOR_UPDATE         = 42;
+    const PHP_MIN                    = '8.0.0';
+    const REV_MIN_FOR_UPDATE         = 53;
     const LATEST_REV_WITH_DB_CHANGES = 53;
     const LATEST_REV_WITH_DB_CHANGES = 53;
     const LOCK_NAME                  = 'lock_update';
     const LOCK_NAME                  = 'lock_update';
     const LOCK_TTL                   = 1800;
     const LOCK_TTL                   = 1800;

+ 0 - 17
app/bootstrap.php

@@ -62,23 +62,6 @@ $c->FORK_REVISION = 53;
 $c->START         = $forkStart;
 $c->START         = $forkStart;
 $c->PUBLIC_URL    = $c->BASE_URL . $forkPublicPrefix;
 $c->PUBLIC_URL    = $c->BASE_URL . $forkPublicPrefix;
 
 
-// Temporary crutch for update from rev.48-
-try {
-    $e = $c->DIR_ROOT;
-} catch (Exception $e) {
-    $c->DIR_APP       = __DIR__;
-    $c->DIR_PUBLIC    = \realpath(__DIR__ . '/../public');
-    $c->DIR_CACHE     = __DIR__ . '/cache';
-    $c->DIR_CONFIG    = __DIR__ . '/config';
-    $c->DIR_VIEWS     = __DIR__ . '/templates';
-    $c->DIR_LANG      = __DIR__ . '/lang';
-    $c->DIR_LOG       = __DIR__ . '/log';
-    $c->DATE_FORMATS  = ['Y-m-d', 'd M Y', 'Y-m-d', 'Y-d-m', 'd-m-Y', 'm-d-Y', 'M j Y', 'jS M Y'];
-    $c->TIME_FORMATS  = ['H:i:s', 'H:i', 'H:i:s', 'H:i', 'g:i:s a', 'g:i a'];
-} finally {
-    unset($e);
-}
-
 $controllers = ['Primary', 'Routing'];
 $controllers = ['Primary', 'Routing'];
 
 
 foreach ($controllers as $controller) {
 foreach ($controllers as $controller) {

+ 1 - 1
composer.json

@@ -24,7 +24,7 @@
         }
         }
     ],
     ],
     "require": {
     "require": {
-        "php": ">=7.3.0",
+        "php": ">=8.0.0",
         "ext-mbstring": "*",
         "ext-mbstring": "*",
         "ext-fileinfo": "*",
         "ext-fileinfo": "*",
         "ext-intl" : "*",
         "ext-intl" : "*",

+ 1 - 1
readme.md

@@ -12,7 +12,7 @@ No: plugins/extensions system, ...
 
 
 ## Requirements
 ## Requirements
 
 
-* PHP 7.3+
+* PHP 8.0+
 * PHP extensions: pdo, intl, json, mbstring, fileinfo
 * PHP extensions: pdo, intl, json, mbstring, fileinfo
 * PHP extensions (suggests): imagick or gd (for upload avatars and other images), openssl (for send email via smtp server using SSL/TLS)
 * PHP extensions (suggests): imagick or gd (for upload avatars and other images), openssl (for send email via smtp server using SSL/TLS)
 * A database such as MySQL 5.5.3+ (an extension using the mysqlnd driver must be enabled), SQLite 3.25+, PostgreSQL 10+
 * A database such as MySQL 5.5.3+ (an extension using the mysqlnd driver must be enabled), SQLite 3.25+, PostgreSQL 10+

+ 2 - 2
vendor/composer/platform_check.php

@@ -4,8 +4,8 @@
 
 
 $issues = array();
 $issues = array();
 
 
-if (!(PHP_VERSION_ID >= 70300)) {
-    $issues[] = 'Your Composer dependencies require a PHP version ">= 7.3.0". You are running ' . PHP_VERSION . '.';
+if (!(PHP_VERSION_ID >= 80000)) {
+    $issues[] = 'Your Composer dependencies require a PHP version ">= 8.0.0". You are running ' . PHP_VERSION . '.';
 }
 }
 
 
 if ($issues) {
 if ($issues) {