Browse Source

Add declaration of argument types and return values

Visman 5 years ago
parent
commit
e87a75cd6d
100 changed files with 466 additions and 425 deletions
  1. 2 1
      app/Controllers/Install.php
  2. 4 1
      app/Controllers/Primary.php
  3. 3 1
      app/Controllers/Routing.php
  4. 5 5
      app/Core/Cache.php
  5. 7 7
      app/Core/Cache/FileCache.php
  6. 5 5
      app/Core/Cache/ProviderCacheInterface.php
  7. 7 7
      app/Core/Container.php
  8. 4 4
      app/Core/Csrf.php
  9. 12 12
      app/Core/DB.php
  10. 23 20
      app/Core/DB/mysql.php
  11. 3 3
      app/Core/DBStatement.php
  12. 9 7
      app/Core/ErrorHandler.php
  13. 16 16
      app/Core/File.php
  14. 9 9
      app/Core/Files.php
  15. 6 6
      app/Core/Func.php
  16. 6 6
      app/Core/Image.php
  17. 4 4
      app/Core/Lang.php
  18. 24 25
      app/Core/Mail.php
  19. 5 5
      app/Core/Parser.php
  20. 12 12
      app/Core/Router.php
  21. 5 5
      app/Core/Secury.php
  22. 17 17
      app/Core/Validator.php
  23. 1 1
      app/Core/Validators.php
  24. 1 1
      app/Core/View.php
  25. 3 3
      app/Models/Action.php
  26. 2 2
      app/Models/AdminList/Model.php
  27. 1 1
      app/Models/BanList/Check.php
  28. 2 1
      app/Models/BanList/Delete.php
  29. 1 1
      app/Models/BanList/Filter.php
  30. 1 1
      app/Models/BanList/GetList.php
  31. 2 1
      app/Models/BanList/Insert.php
  32. 1 1
      app/Models/BanList/IsBanned.php
  33. 2 1
      app/Models/BanList/Load.php
  34. 3 3
      app/Models/BanList/Model.php
  35. 2 1
      app/Models/BanList/Update.php
  36. 8 6
      app/Models/Categories/Manager.php
  37. 1 1
      app/Models/Censorship/Load.php
  38. 2 2
      app/Models/Censorship/Model.php
  39. 2 1
      app/Models/Censorship/Refresh.php
  40. 2 1
      app/Models/Censorship/Save.php
  41. 2 1
      app/Models/Config/Install.php
  42. 2 1
      app/Models/Config/Load.php
  43. 1 1
      app/Models/Config/Model.php
  44. 2 1
      app/Models/Config/Save.php
  45. 8 8
      app/Models/Cookie/Model.php
  46. 2 2
      app/Models/DBMap/Model.php
  47. 7 7
      app/Models/DataModel.php
  48. 2 1
      app/Models/Forum/CalcStat.php
  49. 1 1
      app/Models/Forum/Delete.php
  50. 4 3
      app/Models/Forum/LoadTree.php
  51. 6 6
      app/Models/Forum/Manager.php
  52. 1 1
      app/Models/Forum/Markread.php
  53. 20 19
      app/Models/Forum/Model.php
  54. 3 3
      app/Models/Forum/Refresh.php
  55. 2 2
      app/Models/Forum/Save.php
  56. 1 1
      app/Models/Group/Delete.php
  57. 6 6
      app/Models/Group/Manager.php
  58. 6 6
      app/Models/Group/Model.php
  59. 5 5
      app/Models/Group/Perm.php
  60. 2 2
      app/Models/Group/Save.php
  61. 3 3
      app/Models/ManagerModel.php
  62. 3 3
      app/Models/Method.php
  63. 9 9
      app/Models/Model.php
  64. 2 1
      app/Models/Online/Info.php
  65. 3 3
      app/Models/Online/Model.php
  66. 12 12
      app/Models/Page.php
  67. 3 3
      app/Models/Pages/Admin.php
  68. 13 12
      app/Models/Pages/Admin/Bans.php
  69. 5 4
      app/Models/Pages/Admin/Categories.php
  70. 3 2
      app/Models/Pages/Admin/Censoring.php
  71. 9 8
      app/Models/Pages/Admin/Forums.php
  72. 10 9
      app/Models/Pages/Admin/Groups.php
  73. 2 1
      app/Models/Pages/Admin/Host.php
  74. 2 1
      app/Models/Pages/Admin/Index.php
  75. 5 4
      app/Models/Pages/Admin/Maintenance.php
  76. 3 2
      app/Models/Pages/Admin/Options.php
  77. 3 2
      app/Models/Pages/Admin/Permissions.php
  78. 3 2
      app/Models/Pages/Admin/Statistics.php
  79. 3 4
      app/Models/Pages/Admin/Users.php
  80. 8 7
      app/Models/Pages/Admin/Users/Action.php
  81. 2 1
      app/Models/Pages/Admin/Users/Promote.php
  82. 5 4
      app/Models/Pages/Admin/Users/Result.php
  83. 3 2
      app/Models/Pages/Admin/Users/Stat.php
  84. 5 4
      app/Models/Pages/Admin/Users/View.php
  85. 7 7
      app/Models/Pages/Auth.php
  86. 2 2
      app/Models/Pages/Ban.php
  87. 3 3
      app/Models/Pages/Debug.php
  88. 2 2
      app/Models/Pages/Delete.php
  89. 3 3
      app/Models/Pages/Edit.php
  90. 1 1
      app/Models/Pages/Forum.php
  91. 1 1
      app/Models/Pages/Index.php
  92. 3 3
      app/Models/Pages/Install.php
  93. 1 1
      app/Models/Pages/Maintenance.php
  94. 2 1
      app/Models/Pages/Message.php
  95. 1 1
      app/Models/Pages/Misc.php
  96. 4 5
      app/Models/Pages/Post.php
  97. 1 1
      app/Models/Pages/PostFormTrait.php
  98. 1 1
      app/Models/Pages/PostValidatorTrait.php
  99. 4 4
      app/Models/Pages/Profile.php
  100. 3 2
      app/Models/Pages/Profile/Config.php

+ 2 - 1
app/Controllers/Install.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Controllers;
 
 use ForkBB\Core\Container;
+use ForkBB\Models\Page;
 
 class Install
 {
@@ -27,7 +28,7 @@ class Install
      *
      * @return Page
      */
-    public function routing()
+    public function routing(): Page
     {
         $uri = $_SERVER['REQUEST_URI'];
         if (($pos = \strpos($uri, '?')) !== false) {

+ 4 - 1
app/Controllers/Primary.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Controllers;
 
 use ForkBB\Core\Container;
+use ForkBB\Models\Page;
 
 class Primary
 {
@@ -29,7 +30,7 @@ class Primary
      *
      * @return Page|null
      */
-    public function check()
+    public function check(): ?Page
     {
         if ($this->c->config->o_maintenance && ! $this->c->MAINTENANCE_OFF) {
             if (! isset($this->c->admins->list[$this->c->Cookie->uId])
@@ -50,5 +51,7 @@ class Primary
         if (! $this->c->user->isAdmin && $this->c->bans->check($this->c->user)) {
             return $this->c->Ban->ban($this->c->user);
         }
+
+        return null;
     }
 }

+ 3 - 1
app/Controllers/Routing.php

@@ -3,12 +3,14 @@
 namespace ForkBB\Controllers;
 
 use ForkBB\Core\Container;
+use ForkBB\Models\Page;
 
 class Routing
 {
     const DUO = ['GET', 'POST'];
     const GET = 'GET';
     const PST = 'POST';
+
     /**
      * Контейнер
      * @var Container
@@ -30,7 +32,7 @@ class Routing
      *
      * @return Page
      */
-    public function routing()
+    public function routing(): Page
     {
         $user = $this->c->user;
         $config = $this->c->config;

+ 5 - 5
app/Core/Cache.php

@@ -30,7 +30,7 @@ class Cache
      *
      * @return mixed
      */
-    public function get($key, $default = null)
+    public function get(string $key, $default = null)
     {
         return $this->provider->get($key, $default);
     }
@@ -44,7 +44,7 @@ class Cache
      *
      * @return bool
      */
-    public function set($key, $value, $ttl = null)
+    public function set(string $key, $value, int $ttl = null): bool
     {
         return $this->provider->set($key, $value, $ttl);
     }
@@ -56,7 +56,7 @@ class Cache
      *
      * @return bool
      */
-    public function delete($key)
+    public function delete(striing $key): bool
     {
         return $this->provider->delete($key);
     }
@@ -66,7 +66,7 @@ class Cache
      *
      * @return bool
      */
-    public function clear()
+    public function clear(): bool
     {
         return $this->provider->clear();
     }
@@ -78,7 +78,7 @@ class Cache
      *
      * @return bool
      */
-    public function has($key)
+    public function has(string $key): bool
     {
         return $this->provider->has($key);
     }

+ 7 - 7
app/Core/Cache/FileCache.php

@@ -44,7 +44,7 @@ class FileCache implements ProviderCacheInterface
      *
      * @return mixed
      */
-    public function get($key, $default = null)
+    public function get(string $key, $default = null)
     {
         $file = $this->file($key);
         if (\is_file($file)) {
@@ -68,7 +68,7 @@ class FileCache implements ProviderCacheInterface
      *
      * @return bool
      */
-    public function set($key, $value, $ttl = null)
+    public function set(string $key, $value, int $ttl = null): bool
     {
         $file = $this->file($key);
         $expire = null === $ttl || $ttl < 1 ? 0 : \time() + $ttl;
@@ -90,7 +90,7 @@ class FileCache implements ProviderCacheInterface
      *
      * @return bool
      */
-    public function delete($key)
+    public function delete(string $key): bool
     {
         $file = $this->file($key);
         if (\is_file($file)) {
@@ -110,7 +110,7 @@ class FileCache implements ProviderCacheInterface
      *
      * @return bool
      */
-    public function clear()
+    public function clear(): bool
     {
         $dir = new RecursiveDirectoryIterator($this->cacheDir, RecursiveDirectoryIterator::SKIP_DOTS);
         $iterator = new RecursiveIteratorIterator($dir);
@@ -130,7 +130,7 @@ class FileCache implements ProviderCacheInterface
      *
      * @return bool
      */
-    public function has($key)
+    public function has(string $key): bool
     {
         return null !== $this->get($key);
     }
@@ -144,7 +144,7 @@ class FileCache implements ProviderCacheInterface
      *
      * @return string
      */
-    protected function file($key)
+    protected function file(string $key): string
     {
         if (\is_string($key) && \preg_match('%^[a-z0-9_-]+$%Di', $key)) {
             return $this->cacheDir . '/cache_' . $key . '.php';
@@ -157,7 +157,7 @@ class FileCache implements ProviderCacheInterface
      *
      * @param string $file
      */
-    protected function invalidate($file)
+    protected function invalidate(string $file): void
     {
         if (\function_exists('\\opcache_invalidate')) {
             \opcache_invalidate($file, true);

+ 5 - 5
app/Core/Cache/ProviderCacheInterface.php

@@ -12,7 +12,7 @@ interface ProviderCacheInterface
      *
      * @return mixed
      */
-    public function get($key, $default = null);
+    public function get(string $key, $default = null);
 
     /**
      * Установка данных в кэш по ключу
@@ -23,7 +23,7 @@ interface ProviderCacheInterface
      *
      * @return bool
      */
-    public function set($key, $value, $ttl = null);
+    public function set(string $key, $value, int $ttl = null): bool;
 
     /**
      * Удаление данных по ключу
@@ -32,14 +32,14 @@ interface ProviderCacheInterface
      *
      * @return bool
      */
-    public function delete($key);
+    public function delete(string $key): bool;
 
     /**
      * Очистка кэша
      *
      * @return bool
      */
-    public function clear();
+    public function clear(): bool;
 
     /**
      * Проверка наличия ключа
@@ -48,5 +48,5 @@ interface ProviderCacheInterface
      *
      * @return bool
      */
-    public function has($key);
+    public function has(string $key): bool;
 }

+ 7 - 7
app/Core/Container.php

@@ -41,7 +41,7 @@ class Container
      *
      * @param array config
      */
-    public function config(array $config)
+    public function config(array $config): void
     {
         if (isset($config['shared'])) {
             $this->shared = \array_replace_recursive($this->shared, $config['shared']);
@@ -62,7 +62,7 @@ class Container
      *
      * @return mixed
      */
-    public function __get($id)
+    public function __get(string $id)
     {
         if (isset($this->instances[$id]) || \array_key_exists($id, $this->instances)) { //????
             return $this->instances[$id];
@@ -116,7 +116,7 @@ class Container
      * @param string $id
      * @param mixed $service
      */
-    public function __set($id, $service)
+    public function __set(string $id, $service): void
     {
         if (\strpos($id, '.') !== false) {
             //????
@@ -135,10 +135,10 @@ class Container
      */
     public function fromArray(array $array, array $tree)
     {
-        $ptr = & $array;
+        $ptr = &$array;
         foreach ($tree as $s) {
             if (isset($ptr[$s])) {
-                $ptr = & $ptr[$s];
+                $ptr = &$ptr[$s];
             } else {
                 return null;
             }
@@ -157,7 +157,7 @@ class Container
      *
      * @return ContainerInterface Self reference
      */
-    public function setParameter($name, $value)
+    public function setParameter(string $name, $value): self
     {
         $segments = \explode('.', $name);
         $n = \count($segments);
@@ -212,7 +212,7 @@ class Container
      *
      * @return bool
      */
-    public function isInit($name)
+    public function isInit(string $name): bool
     {
         return \array_key_exists($name, $this->instances);
     }

+ 4 - 4
app/Core/Csrf.php

@@ -20,9 +20,9 @@ class Csrf
      * Конструктор
      *
      * @param Secury $secury
-     * @param User $user
+     * @param string $key
      */
-    public function __construct(Secury $secury, $key)
+    public function __construct(Secury $secury, string $key)
     {
         $this->secury = $secury;
         $this->key = \sha1($key);
@@ -37,7 +37,7 @@ class Csrf
      *
      * @return string
      */
-    public function create($marker, array $args = [], $time = null)
+    public function create(string $marker, array $args = [], $time = null): string
     {
          unset($args['token'], $args['#']);
          \ksort($args);
@@ -58,7 +58,7 @@ class Csrf
      *
      * @return bool
      */
-    public function verify($token, $marker, array $args = [])
+    public function verify($token, string $marker, array $args = []): bool
     {
         return \is_string($token)
             && \preg_match('%f(\d+)$%D', $token, $matches)

+ 12 - 12
app/Core/DB.php

@@ -56,7 +56,7 @@ class DB extends PDO
      *
      * @throws PDOException
      */
-    public function __construct($dsn, $username = null, $password = null, array $options = [], $prefix = '')
+    public function __construct(string $dsn, string $username = null, string $password = null, array $options = [], string $prefix = '')
     {
         $type = \strstr($dsn, ':', true);
         if (
@@ -89,7 +89,7 @@ class DB extends PDO
      *
      * @return mixed
      */
-    public function __call($name, array $args)
+    public function __call(string $name, array $args)
     {
         if (empty($this->dbDrv)) {
             $drv = 'ForkBB\\Core\\DB\\' . \ucfirst($this->dbType);
@@ -105,7 +105,7 @@ class DB extends PDO
      *
      * @return bool
      */
-    protected function isOptions(array $arr)
+    protected function isOptions(array $arr): bool
     {
         $verify = [self::ATTR_CURSOR => [self::CURSOR_FWDONLY, self::CURSOR_SCROLL]];
 
@@ -127,7 +127,7 @@ class DB extends PDO
      *
      * @return array
      */
-    protected function parse(&$query, array $params)
+    protected function parse(string &$query, array $params): array
     {
         $idxIn = 0;
         $idxOut = 1;
@@ -214,7 +214,7 @@ class DB extends PDO
      *
      * @return int
      */
-    public function getCount()
+    public function getCount(): int
     {
         return $this->qCount;
     }
@@ -224,7 +224,7 @@ class DB extends PDO
      *
      * @return array
      */
-    public function getQueries()
+    public function getQueries(): array
     {
         return $this->queries;
     }
@@ -236,7 +236,7 @@ class DB extends PDO
      * @param float $time
      * @param bool $add
      */
-    public function saveQuery($query, $time, $add = true)
+    public function saveQuery(string $query, float $time, bool $add = true): void
     {
         if ($add) {
             ++$this->qCount;
@@ -286,7 +286,7 @@ class DB extends PDO
      *
      * @return PDOStatement
      */
-    public function prepare($query, $arg1 = null, $arg2 = null)
+    public function prepare($query, $arg1 = null, $arg2 = null): PDOStatement
     {
         if (empty($arg1) === empty($arg2) || ! empty($arg2)) {
             $params = $arg1;
@@ -320,7 +320,7 @@ class DB extends PDO
      *
      * @return PDOStatement|false
      */
-    public function query($query, ...$args)
+    public function query(string $query, ...$args)
     {
         if (isset($args[0]) && \is_array($args[0])) {
             $params = \array_shift($args);
@@ -357,7 +357,7 @@ class DB extends PDO
     /**
      * @return bool
      */
-    public function beginTransaction()
+    public function beginTransaction(): bool
     {
         $start = \microtime(true);
         $result = parent::beginTransaction();
@@ -368,7 +368,7 @@ class DB extends PDO
     /**
      * @return bool
      */
-    public function commit()
+    public function commit(): bool
     {
         $start = \microtime(true);
         $result = parent::commit();
@@ -379,7 +379,7 @@ class DB extends PDO
     /**
      * @return bool
      */
-    public function rollback()
+    public function rollback(): bool
     {
         $start = \microtime(true);
         $result = parent::rollback();

+ 23 - 20
app/Core/DB/mysql.php

@@ -67,7 +67,7 @@ class Mysql
      *
      * @throws PDOException
      */
-    public function __call($name, array $args)
+    public function __call(string $name, array $args)
     {
         throw new PDOException("Method '{$name}' not found in DB driver.");
     }
@@ -79,7 +79,7 @@ class Mysql
      *
      * @throws PDOException
      */
-    protected function testStr($str)
+    protected function testStr(string $str): void
     {
         if (! \is_string($str) || \preg_match('%[^a-zA-Z0-9_]%', $str)) {
             throw new PDOException("Name '{$str}' have bad characters.");
@@ -93,7 +93,7 @@ class Mysql
      *
      * @return string
      */
-    protected function replIdxs(array $arr)
+    protected function replIdxs(array $arr): string
     {
         foreach ($arr as &$value) {
             if (\preg_match('%^(.*)\s*(\(\d+\))$%', $value, $matches)) {
@@ -115,7 +115,7 @@ class Mysql
      *
      * @return string
      */
-    protected function replType($type)
+    protected function replType(string $type): string
     {
         return \preg_replace(\array_keys($this->dbTypeRepl), \array_values($this->dbTypeRepl), $type);
     }
@@ -129,7 +129,8 @@ class Mysql
      *
      * @return string
      */
-    protected function convToStr($data) {
+    protected function convToStr($data): string
+    {
         if (\is_string($data)) {
             return $this->db->quote($data);
         } elseif (\is_numeric($data)) {
@@ -149,7 +150,7 @@ class Mysql
      *
      * @return bool
      */
-    public function tableExists($table, $noPrefix = false)
+    public function tableExists(string $table, bool $noPrefix = false): bool
     {
         $table = ($noPrefix ? '' : $this->dbPrefix) . $table;
         try {
@@ -171,7 +172,7 @@ class Mysql
      *
      * @return bool
      */
-    public function fieldExists($table, $field, $noPrefix = false)
+    public function fieldExists(string $table, string $field, bool $noPrefix = false): bool
     {
         $table = ($noPrefix ? '' : $this->dbPrefix) . $table;
         try {
@@ -193,7 +194,7 @@ class Mysql
      *
      * @return bool
      */
-    public function indexExists($table, $index, $noPrefix = false)
+    public function indexExists(string $table, string $index, bool $noPrefix = false): bool
     {
         $table = ($noPrefix ? '' : $this->dbPrefix) . $table;
         $index = $index == 'PRIMARY' ? $index : $table . '_' . $index;
@@ -216,7 +217,7 @@ class Mysql
      *
      * @return bool
      */
-    public function createTable($table, array $schema, $noPrefix = false)
+    public function createTable(string $table, array $schema, bool $noPrefix = false): bool
     {
         $table = ($noPrefix ? '' : $this->dbPrefix) . $table;
         $this->testStr($table);
@@ -297,7 +298,7 @@ class Mysql
      *
      * @return bool
      */
-    public function dropTable($table, $noPrefix = false)
+    public function dropTable(string $table, bool $noPrefix = false): bool
     {
         $table = ($noPrefix ? '' : $this->dbPrefix) . $table;
         $this->testStr($table);
@@ -313,7 +314,7 @@ class Mysql
      *
      * @return bool
      */
-    public function renameTable($old, $new, $noPrefix = false)
+    public function renameTable(string $old, string $new, bool $noPrefix = false): bool
     {
         if ($this->tableExists($new, $noPrefix) && ! $this->tableExists($old, $noPrefix)) {
             return true;
@@ -330,6 +331,7 @@ class Mysql
      *
      * @param string $table
      * @param string $field
+     * @param string $type
      * @param bool $allowNull
      * @param mixed $default
      * @param string $after
@@ -337,7 +339,7 @@ class Mysql
      *
      * @return bool
      */
-    public function addField($table, $field, $type, $allowNull, $default = null, $after = null, $noPrefix = false)
+    public function addField(string $table, string $field, string $type, bool $allowNull, $default = null, string $after = null, bool $noPrefix = false): bool
     {
         if ($this->fieldExists($table, $field, $noPrefix)) {
             return true;
@@ -364,6 +366,7 @@ class Mysql
      *
      * @param string $table
      * @param string $field
+     * @param string $type
      * @param bool $allowNull
      * @param mixed $default
      * @param string $after
@@ -371,7 +374,7 @@ class Mysql
      *
      * @return bool
      */
-    public function alterField($table, $field, $type, $allowNull, $default = null, $after = null, $noPrefix = false)
+    public function alterField(string $table, string $field, string $type, bool $allowNull, $default = null, string $after = null, bool $noPrefix = false): bool
     {
         $table = ($noPrefix ? '' : $this->dbPrefix) . $table;
         $this->testStr($table);
@@ -399,7 +402,7 @@ class Mysql
      *
      * @return bool
      */
-    public function dropField($table, $field, $noPrefix = false)
+    public function dropField(string $table, string $field, bool $noPrefix = false): bool
     {
         if (! $this->fieldExists($table, $field, $noPrefix)) {
             return true;
@@ -421,7 +424,7 @@ class Mysql
      *
      * @return bool
      */
-    public function addIndex($table, $index, array $fields, $unique = false, $noPrefix = false)
+    public function addIndex(string $table, string $index, array $fields, bool $unique = false, bool $noPrefix = false): bool
     {
         if ($this->indexExists($table, $index, $noPrefix)) {
             return true;
@@ -453,7 +456,7 @@ class Mysql
      *
      * @return bool
      */
-    public function dropIndex($table, $index, $noPrefix = false)
+    public function dropIndex(string $table, string $index, bool $noPrefix = false): bool
     {
         if (! $this->indexExists($table, $index, $noPrefix)) {
             return true;
@@ -479,7 +482,7 @@ class Mysql
      *
      * @return bool
      */
-    public function truncateTable($table, $noPrefix = false)
+    public function truncateTable(string $table, bool $noPrefix = false): bool
     {
         $table = ($noPrefix ? '' : $this->dbPrefix) . $table;
         $this->testStr($table);
@@ -489,9 +492,9 @@ class Mysql
     /**
      * Статистика
      *
-     * @return array|string
+     * @return array
      */
-    public function statistics()
+    public function statistics(): array
     {
         $this->testStr($this->dbPrefix);
         $prefix = str_replace('_', '\\_', $this->dbPrefix);
@@ -532,7 +535,7 @@ class Mysql
      *
      * @return array
      */
-    public function getMap()
+    public function getMap(): array
     {
         $stmt = $this->db->query('SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME LIKE ?s', ["{$this->dbPrefix}%"]);
         $result = [];

+ 3 - 3
app/Core/DBStatement.php

@@ -49,7 +49,7 @@ class DBStatement extends PDOStatement
      *
      * @param array $map
      */
-    public function setMap(array $map)
+    public function setMap(array $map): void
     {
         $this->map = $map;
     }
@@ -61,7 +61,7 @@ class DBStatement extends PDOStatement
      *
      * @throws PDOException
      */
-    public function bindValueList(array $params)
+    public function bindValueList(array $params): void
     {
         foreach ($this->map as $key => $data) {
             $type = \array_shift($data);
@@ -90,7 +90,7 @@ class DBStatement extends PDOStatement
      *
      * @return bool
      */
-    public function execute($params = null)
+    public function execute($params = null): bool
     {
         if (\is_array($params) && ! empty($params)) {
             $this->bindValueList($params);

+ 9 - 7
app/Core/ErrorHandler.php

@@ -2,6 +2,8 @@
 
 namespace ForkBB\Core;
 
+use Throwable;
+
 class ErrorHandler
 {
     /**
@@ -87,7 +89,7 @@ class ErrorHandler
      *
      * @return bool
      */
-    public function errorHandler($type, $message, $file, $line)
+    public function errorHandler(int $type, string $message, string $file, string $line): bool
     {
         $error = [
             'type'    => $type,
@@ -112,7 +114,7 @@ class ErrorHandler
      *
      * @param Exception|Throwable $e
      */
-    public function exceptionHandler($e)
+    public function exceptionHandler(Throwable $e): void
     {
         $this->error = [
             'type'    => 0, //????
@@ -126,7 +128,7 @@ class ErrorHandler
     /**
      * Окончательно обрабатывает ошибки (в том числе фатальные) и исключения
      */
-    public function shutdownHandler()
+    public function shutdownHandler(): void
     {
         if (isset($this->error['type'])) {
             $show = true;
@@ -171,7 +173,7 @@ class ErrorHandler
      *
      * @param array $error
      */
-    protected function log(array $error)
+    protected function log(array $error): void
     {
         $this->logged = true;
         $message = \preg_replace('%[\x00-\x1F]%', ' ', $this->message($error));
@@ -184,7 +186,7 @@ class ErrorHandler
      *
      * @param array $error
      */
-    protected function show(array $error)
+    protected function show(array $error): void
     {
         \header('HTTP/1.1 500 Internal Server Error');
 
@@ -274,7 +276,7 @@ EOT;
      *
      * @return string
      */
-    protected function message(array $error)
+    protected function message(array $error): string
     {
         $type = isset($this->type[$error['type']]) ? $this->type[$error['type']] : $this->type[0];
         $file = \str_replace($this->hidePath, '...', $error['file']);
@@ -288,7 +290,7 @@ EOT;
      *
      * @return string
      */
-    protected function e($arg)
+    protected function e(string $arg): string
     {
         return \htmlspecialchars($arg, \ENT_HTML5 | \ENT_QUOTES | \ENT_SUBSTITUTE, 'UTF-8');
     }

+ 16 - 16
app/Core/File.php

@@ -105,7 +105,7 @@ class File
      *
      * @return null|string
      */
-    public function error()
+    public function error(): ?string
     {
         return $this->error;
     }
@@ -117,7 +117,7 @@ class File
      *
      * @return string
      */
-    protected function filterName($name)
+    protected function filterName(string $name): string
     {
         if (\function_exists('\\transliterator_transliterate')) {
             $name = \transliterator_transliterate("Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();", $name);
@@ -137,13 +137,13 @@ class File
      *
      * @param string $path
      *
-     * @return false|array
+     * @return null|array
      */
-    protected function pathinfo($path)
+    protected function pathinfo(string $path): ?array
     {
         if (! \preg_match($this->pattern, $path, $matches)) {
             $this->error = 'The path/name format is broken';
-            return false;
+            return null;
         }
 
         if ('*' === $matches[2]) {
@@ -152,7 +152,7 @@ class File
 
         if ('*' === $matches[3]) {
             $matches[3] = $this->ext;
-        } elseif ('(' === $matches[3]{0} && ')' === $matches[3]{\strlen($matches[3]) - 1}) {
+        } elseif ('(' === $matches[3][0] && ')' === $matches[3][\strlen($matches[3]) - 1]) {
             $matches[3] = \explode('|', \substr($matches[3], 1, -1));
 
             if (1 === \count($matches[3])) {
@@ -174,7 +174,7 @@ class File
      *
      * @return File
      */
-    public function rename($rename)
+    public function rename(bool $rename): self
     {
         $this->rename = $rename;
 
@@ -188,7 +188,7 @@ class File
      *
      * @return File
      */
-    public function rewrite($rewrite)
+    public function rewrite(bool $rewrite): self
     {
         $this->rewrite = $rewrite;
 
@@ -202,7 +202,7 @@ class File
      *
      * @return bool
      */
-    protected function dirProc($dirname)
+    protected function dirProc(string $dirname): bool
     {
         if (! \is_dir($dirname)) {
             if (! @\mkdir($dirname, 0755)) {
@@ -225,7 +225,7 @@ class File
      *
      * @return bool
      */
-    protected function fileProc($path)
+    protected function fileProc(string $path): bool
     {
         if (\is_string($this->data)) {
             if (! \file_put_contents($this->path, $path)) {
@@ -250,11 +250,11 @@ class File
      *
      * @return bool
      */
-    public function toFile($path)
+    public function toFile(string $path): bool
     {
         $info = $this->pathinfo($path);
 
-        if (false === $info || ! $this->dirProc($info['dirname'])) {
+        if (null === $info || ! $this->dirProc($info['dirname'])) {
             return false;
         }
 
@@ -283,22 +283,22 @@ class File
         }
     }
 
-    public function name()
+    public function name(): string
     {
         return $this->name;
     }
 
-    public function ext()
+    public function ext(): string
     {
         return $this->ext;
     }
 
-    public function size()
+    public function size(): int
     {
         return $this->size;
     }
 
-    public function path()
+    public function path(): string
     {
         return $this->path;
     }

+ 9 - 9
app/Core/Files.php

@@ -88,7 +88,7 @@ class Files
      *
      * @return int
      */
-    public function maxImgSize($unit = null)
+    public function maxImgSize(string $unit = null): int
     {
         return $this->size($this->maxImgSize, $unit);
     }
@@ -100,7 +100,7 @@ class Files
      *
      * @return int
      */
-    public function maxFileSize($unit = null)
+    public function maxFileSize(string $unit = null): int
     {
         return $this->size($this->maxFileSize, $unit);
     }
@@ -116,7 +116,7 @@ class Files
      *
      * @return int|float
      */
-    public function size($value, $to = null)
+    public function size($value, string $to = null)
     {
         if (\is_string($value)) {
             if (! \preg_match('%^([^a-z]+)([a-z]+)?$%i', \trim($value), $matches)) {
@@ -160,7 +160,7 @@ class Files
      *
      * @return null|string
      */
-    public function error()
+    public function error(): ?string
     {
         return $this->error;
     }
@@ -170,9 +170,9 @@ class Files
      *
      * @param mixed $file
      *
-     * @return false|string
+     * @return string|null
      */
-    public function isImage($file)
+    public function isImage($file): ?string
     {
         if (\is_string($file)) {
             if (\function_exists('\\exif_imagetype')) {
@@ -187,10 +187,10 @@ class Files
             } else {
                 $type = 0;
             }
-            return isset($this->imageType[$type]) ? $this->imageType[$type] : false;
+            return isset($this->imageType[$type]) ? $this->imageType[$type] : null;
         }
 
-        return $file instanceof Image ? $file->ext() : false;
+        return $file instanceof Image ? $file->ext() : null;
     }
 
     /**
@@ -291,7 +291,7 @@ class Files
 
         $isImage = $this->isImage($file['tmp_name']);
 
-        if (false !== $isImage) {
+        if (null !== $isImage) {
             $ext     = $isImage;
             $isImage = 'swf' !== $isImage; // флеш не будет картинкой
         }

+ 6 - 6
app/Core/Func.php

@@ -45,7 +45,7 @@ class Func
      *
      * @return array
      */
-    public function getStyles()
+    public function getStyles(): array
     {
         if (! \is_array($this->styles)) {
             $this->styles = $this->getFoldersWithFile($this->c->DIR_PUBLIC . '/style', 'style.css');
@@ -58,7 +58,7 @@ class Func
      *
      * @return array
      */
-    public function getLangs()
+    public function getLangs(): array
     {
         if (! \is_array($this->langs)) {
             $this->langs = $this->getFoldersWithFile($this->c->DIR_LANG, 'common.po');
@@ -71,7 +71,7 @@ class Func
      *
      * @return array
      */
-    public function getNameLangs()
+    public function getNameLangs(): array
     {
         if (! \is_array($this->nameLangs)) {
             $langs = $this->getLangs();
@@ -93,7 +93,7 @@ class Func
      *
      * @return array
      */
-    public function getFoldersWithFile($dir, $file)
+    public function getFoldersWithFile(string $dir, string $file): array
     {
         $result = [];
         if (\is_dir($dir) && ($dh = \opendir($dir)) !== false) {
@@ -123,7 +123,7 @@ class Func
      *
      * @return array
      */
-    public function paginate($all, $cur, $marker, array $args = [], $info = 'Page %1$s of %2$s')
+    public function paginate(int $all, int $cur, string $marker, array $args = [], string $info = 'Page %1$s of %2$s'): array
     {
         $pages = [];
         if ($all < 2) {
@@ -173,7 +173,7 @@ class Func
      *
      * @return array
      */
-    public function langParse($str)
+    public function langParse(string $str): array
     {
         $result = [];
 

+ 6 - 6
app/Core/Image.php

@@ -64,7 +64,7 @@ class Image extends File
      *
      * @return Image
      */
-    public function resize($maxW, $maxH)
+    public function resize(int $maxW, int $maxH): self
     {
         $oldW   = \imagesx($this->image);
         $oldH   = \imagesy($this->image);
@@ -105,14 +105,14 @@ class Image extends File
      *
      * @param string $path
      *
-     * @return false|array
+     * @return null|array
      */
-    protected function pathinfo($path)
+    protected function pathinfo(string $path): ?array
     {
         $info = parent::pathinfo($path);
 
-        if (false === $info) {
-            return false;
+        if (null === $info) {
+            return null;
         }
 
         if (\is_array($info['extension'])) {
@@ -133,7 +133,7 @@ class Image extends File
      *
      * @return bool
      */
-    protected function fileProc($path)
+    protected function fileProc(string $path): bool
     {
         switch (\pathinfo($path, \PATHINFO_EXTENSION)) {
             case 'jpg':

+ 4 - 4
app/Core/Lang.php

@@ -43,7 +43,7 @@ class Lang
      *
      * @return string|array
      */
-    public function get($message, $lang = null)
+    public function get(string $message, string $lang = null)
     {
         if ($lang && isset($this->tr[$lang][$message])) {
             return $this->tr[$lang][$message];
@@ -65,7 +65,7 @@ class Lang
      * @param string $lang
      * @param string $path
      */
-    public function load($name, $lang = null, $path = null)
+    public function load(string $name, string $lang = null, string $path = null): void
     {
         if ($lang) {
             if (isset($this->loaded[$name][$lang])) {
@@ -105,7 +105,7 @@ class Lang
      *
      * @return array
      */
-    protected function arrayFromStr($str)
+    protected function arrayFromStr(string $str): array
     {
         $lines = \explode("\n", $str);
         $count = \count($lines);
@@ -253,7 +253,7 @@ class Lang
      *
      * @return string
      */
-    protected function originalLine($line)
+    protected function originalLine(string $line): string
     {
         if (isset($line[1]) && $line[0] == '"' && $line[\strlen($line) - 1] == '"') {
             $line = \substr($line, 1, -1);

+ 24 - 25
app/Core/Mail.php

@@ -89,7 +89,7 @@ class Mail
      *
      * @return false|string
      */
-    public function valid($email, $strict = false, $idna = false)
+    public function valid($email, bool $strict = false, bool $idna = false)
     {
         if (! \is_string($email)
             || \mb_strlen($email, 'UTF-8') > 80 //???? for DB
@@ -148,7 +148,7 @@ class Mail
      *
      * @return Mail
      */
-    public function reset()
+    public function reset(): self
     {
         $this->to = [];
         $this->headers = [];
@@ -163,7 +163,7 @@ class Mail
      *
      * @return Mail
      */
-    public function setSubject($subject)
+    public function setSubject(string $subject): self
     {
         $this->headers['Subject'] = $this->encodeText(\preg_replace('%[\x00-\x1F]%', '', \trim($subject)));
         return $this;
@@ -177,10 +177,9 @@ class Mail
      *
      * @return Mail
      */
-    public function addTo($email, $name = null)
+    public function addTo($email, string $name = null): self
     {
-        if (\is_array($email)) {
-        } else {
+        if (! \is_array($email)) {
             $email = \preg_split('%[,\n\r]%', (string) $email, -1, PREG_SPLIT_NO_EMPTY);
         }
         foreach($email as $cur) {
@@ -200,7 +199,7 @@ class Mail
      *
      * @return Mail
      */
-    public function setTo($email, $name = null)
+    public function setTo($email, string $name = null): self
     {
         $this->to = [];
         return $this->addTo($email, $name);
@@ -214,7 +213,7 @@ class Mail
      *
      * @return Mail
      */
-    public function setFrom($email, $name = null)
+    public function setFrom(string $email, string $name = null): self
     {
         $email = $this->valid($email, false, true);
         if (false !== $email) {
@@ -231,7 +230,7 @@ class Mail
      *
      * @return Mail
      */
-    public function setReplyTo($email, $name = null)
+    public function setReplyTo(string $email, string $name = null): self
     {
         $email = $this->valid($email, false, true);
         if (false !== $email) {
@@ -248,7 +247,7 @@ class Mail
      *
      * @return string
      */
-    protected function formatAddress($email, $name = null)
+    protected function formatAddress($email, string $name = null): string
     {
         if (! \is_string($name) || \strlen(\trim($name)) == 0) {
             return $email;
@@ -265,7 +264,7 @@ class Mail
      *
      * @return string
      */
-    protected function encodeText($str)
+    protected function encodeText(string $str): string
     {
         if (\preg_match('%[^\x20-\x7F]%', $str)) {
             return '=?UTF-8?B?' . \base64_encode($str) . '?=';
@@ -281,7 +280,7 @@ class Mail
      *
      * @return string
      */
-    protected function filterName($name)
+    protected function filterName(string $name): string
     {
         return \addcslashes(\preg_replace('%[\x00-\x1F]%', '', \trim($name)), '\\"');
     }
@@ -293,7 +292,7 @@ class Mail
      *
      * @return Mail
      */
-    public function setFolder($folder)
+    public function setFolder(string $folder): self
     {
         $this->folder = $folder;
         return $this;
@@ -306,7 +305,7 @@ class Mail
      *
      * @return Mail
      */
-    public function setLanguage($language)
+    public function setLanguage(string $language): self
     {
         $this->language = $language;
         return $this;
@@ -322,7 +321,7 @@ class Mail
      *
      * @return Mail
      */
-    public function setTpl($tpl, array $data)
+    public function setTpl(string $tpl, array $data): self
     {
         $file = \rtrim($this->folder, '\\/') . '/' . $this->language . '/mail/' . $tpl;
         if (! \is_file($file)) {
@@ -347,7 +346,7 @@ class Mail
      *
      * @return Mail
      */
-    public function setMessage($message)
+    public function setMessage(string $message): self
     {
         $this->message = \str_replace("\0", $this->EOL,
                          \str_replace(["\r\n", "\n", "\r"], "\0",
@@ -363,7 +362,7 @@ class Mail
      *
      * @return bool
      */
-    public function send()
+    public function send(): bool
     {
         if (empty($this->to)) {
             throw new MailException('No recipient for the email.');
@@ -398,7 +397,7 @@ class Mail
      *
      * @return bool
      */
-    protected function mail()
+    protected function mail(): bool
     {
         $to = \implode(', ', $this->to);
         $subject = $this->headers['Subject'];
@@ -415,7 +414,7 @@ class Mail
      *
      * @return string
      */
-    protected function strHeaders(array $headers)
+    protected function strHeaders(array $headers): string
     {
         foreach ($headers as $key => &$value) {
             $value = $key . ': ' . $value;
@@ -431,7 +430,7 @@ class Mail
      *
      * @return bool
      */
-    protected function smtp()
+    protected function smtp(): bool
     {
         // подлючение
         if (! \is_resource($this->connect)) {
@@ -461,7 +460,7 @@ class Mail
     /**
      * Hello SMTP server
      */
-    protected function smtpHello()
+    protected function smtpHello(): void
     {
         switch ($this->auth) {
             case 1:
@@ -496,9 +495,9 @@ class Mail
      *
      * @return string
      */
-    protected function smtpData($data, $code)
+    protected function smtpData(string $data, $code): string
     {
-        if (\is_resource($this->connect) && \is_string($data)) {
+        if (\is_resource($this->connect)) {
             if (@\fwrite($this->connect, $data . $this->EOL) === false) {
                 throw new SmtpException('Couldn\'t send data to mail server.');
             }
@@ -527,7 +526,7 @@ class Mail
      *
      * @return string
      */
-    protected function getEmailFrom($str)
+    protected function getEmailFrom(string $str): string
     {
         $match = \explode('" <', $str);
         if (\count($match) == 2 && \substr($match[1], -1) == '>') {
@@ -542,7 +541,7 @@ class Mail
      *
      * @return string
      */
-    protected function hostname()
+    protected function hostname(): string
     {
         return empty($_SERVER['SERVER_NAME'])
             ? (isset($_SERVER['SERVER_ADDR']) ? '[' . $_SERVER['SERVER_ADDR'] . ']' : '[127.0.0.1]')

+ 5 - 5
app/Core/Parser.php

@@ -29,7 +29,7 @@ class Parser extends Parserus
     /**
      * Инициализация данных
      */
-    protected function init()
+    protected function init(): void
     {
         if ($this->c->config->p_message_bbcode == '1' || $this->c->config->p_sig_bbcode == '1') {
             $bbcodes = include $this->c->DIR_CONFIG . '/defaultBBCode.php';
@@ -63,7 +63,7 @@ class Parser extends Parserus
      *
      * @return Parser
      */
-    public function addBBCode(array $bb)
+    public function addBBCode(array $bb): self
     {
         if ($bb['tag'] == 'quote') {
             $bb['self nesting'] = (int) $this->c->config->o_quote_depth;
@@ -81,7 +81,7 @@ class Parser extends Parserus
      *
      * @return string
      */
-    public function prepare($text, $isSignature = false)
+    public function prepare(string $text, bool $isSignature = false): string
     {
         if ($isSignature) {
             $whiteList = $this->c->config->p_sig_bbcode == '1' ? $this->c->BBCODE_INFO['forSign'] : [];
@@ -112,7 +112,7 @@ class Parser extends Parserus
      *
      * @return string
      */
-    public function parseMessage($text = null, $hideSmilies = false)
+    public function parseMessage(string $text = null, bool $hideSmilies = false): string
     {
         // при null предполагается брать данные после prepare()
         if (null !== $text) {
@@ -139,7 +139,7 @@ class Parser extends Parserus
      *
      * @return string
      */
-    public function parseSignature($text = null)
+    public function parseSignature(string $text = null): string
     {
         // при null предполагается брать данные после prepare()
         if (null !== $text) {

+ 12 - 12
app/Core/Router.php

@@ -91,7 +91,7 @@ class Router
      *
      * @return string
      */
-    public function validate($url, $defMarker, array $defArgs = [])
+    public function validate($url, string $defMarker, array $defArgs = []): string
     {
         if (\is_string($url)
             && \parse_url($url, PHP_URL_HOST) === $this->host
@@ -116,7 +116,7 @@ class Router
      *
      * @return string
      */
-    public function link($marker = null, array $args = [])
+    public function link(string $marker = null, array $args = []): string
     {
         $result = $this->baseUrl;
         $anchor = isset($args['#']) ? '#' . \rawurlencode($args['#']) : '';
@@ -167,7 +167,7 @@ class Router
      *
      * @return array
      */
-    public function route($method, $uri)
+    public function route(string $method, string $uri): array
     {
         $head = $method == 'HEAD';
 
@@ -239,7 +239,7 @@ class Router
      * @param string $handler
      * @param string $marker
      */
-    public function add($method, $route, $handler, $marker = null)
+    public function add($method, string $route, string $handler, string $marker = null): void
     {
         if (\is_array($method)) {
             foreach ($method as $m) {
@@ -293,9 +293,9 @@ class Router
      *
      * @param string $route
      *
-     * @return array|false
+     * @return array|null
      */
-    protected function parse($route)
+    protected function parse(string $route): ?array
     {
         $parts = \preg_split('%([\[\]{}/])%', $route, -1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE);
 
@@ -323,14 +323,14 @@ class Router
             if ($var) {
                 switch ($part) {
                     case '{':
-                        return false;
+                        return null;
                     case '}':
                         $data = \explode(':', $buffer, 2);
                         if (! isset($data[1])) {
                             $data[1] = '[^/\x00-\x1f]+';
                         }
                         if ($data[0] === '' || $data[1] === '' || \is_numeric($data[0][0])) {
-                            return false;
+                            return null;
                         }
                         $pattern .= '(?P<' . $data[0] . '>' . $data[1] . ')';
                         $args[]   = $data[0];
@@ -350,7 +350,7 @@ class Router
                         $temp    .= $part;
                         break;
                     default:
-                        return false;
+                        return null;
                 }
             } else {
                 switch ($part) {
@@ -364,7 +364,7 @@ class Router
                     case ']':
                         --$s;
                         if ($s < 0) {
-                            return false;
+                            return null;
                         }
                         $pattern .= ')?';
                         $req      = true;
@@ -374,7 +374,7 @@ class Router
                         $var = true;
                         break;
                     case '}':
-                        return false;
+                        return null;
                     default:
                         $pattern .= \preg_quote($part, '%');
                         $temp    .= $part;
@@ -382,7 +382,7 @@ class Router
             }
         }
         if ($var || $s) {
-            return false;
+            return null;
         }
         $pattern .= '$%D';
         return [$base, $pattern, $args, $temp, $argsReq];

+ 5 - 5
app/Core/Secury.php

@@ -40,7 +40,7 @@ class Secury
      *
      * @return string
      */
-    public function hash($data)
+    public function hash(string $data): string
     {
         return $this->hmac($data, \md5(__DIR__));
     }
@@ -55,7 +55,7 @@ class Secury
      *
      * @return string
      */
-    public function hmac($data, $key)
+    public function hmac(string $data, string $key): string
     {
         if (empty($key)) {
             throw new InvalidArgumentException('Key can not be empty');
@@ -72,7 +72,7 @@ class Secury
      *
      * @return string
      */
-    public function randomKey($len)
+    public function randomKey(int $len): string
     {
         $key = '';
         if (\function_exists('\\random_bytes')) {
@@ -100,7 +100,7 @@ class Secury
      *
      * @return string
      */
-    public function randomHash($len)
+    public function randomHash(int $len): string
     {
         return \substr(\bin2hex($this->randomKey($len)), 0, $len);
     }
@@ -113,7 +113,7 @@ class Secury
      *
      * @return string
      */
-    public function randomPass($len)
+    public function randomPass(int $len): string
     {
         $key = $this->randomKey($len);
         $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';

+ 17 - 17
app/Core/Validator.php

@@ -103,7 +103,7 @@ class Validator
      *
      * @return Validator
      */
-    public function reset()
+    public function reset(): self
     {
         $this->validators = [
             'absent'        => [$this, 'vAbsent'],
@@ -145,7 +145,7 @@ class Validator
      *
      * @return Validator
      */
-    public function addValidators(array $validators)
+    public function addValidators(array $validators): self
     {
         $this->validators = \array_replace($this->validators, $validators);
         return $this;
@@ -160,7 +160,7 @@ class Validator
      *
      * @return Validator
      */
-    public function addRules(array $list)
+    public function addRules(array $list): self
     {
         foreach ($list as $field => $raw) {
             $suffix = null;
@@ -206,7 +206,7 @@ class Validator
      *
      * @return Validator
      */
-    public function addArguments(array $arguments)
+    public function addArguments(array $arguments): self
     {
         $this->arguments = \array_replace($this->arguments, $arguments);
         return $this;
@@ -219,7 +219,7 @@ class Validator
      *
      * @return Validator
      */
-    public function addMessages(array $messages)
+    public function addMessages(array $messages): self
     {
         $this->messages = \array_replace($this->messages, $messages);
         return $this;
@@ -232,7 +232,7 @@ class Validator
      *
      * @return Validator
      */
-    public function addAliases(array $aliases)
+    public function addAliases(array $aliases): self
     {
         $this->aliases = \array_replace($this->aliases, $aliases);
         return $this;
@@ -247,7 +247,7 @@ class Validator
      *
      * @return bool
      */
-    public function validation(array $raw)
+    public function validation(array $raw): bool
     {
         if (empty($this->rules)) {
             throw new RuntimeException('Rules not found');
@@ -270,7 +270,7 @@ class Validator
      *
      * @return bool
      */
-    public function __isset($field)
+    public function __isset(string $field): bool
     {
         return isset($this->result[$field]);
     }
@@ -285,7 +285,7 @@ class Validator
      *
      * @return mixed
      */
-    public function __get($field)
+    public function __get(string $field)
     {
         if (isset($this->status[$field])) {
             return $this->result[$field];
@@ -326,7 +326,7 @@ class Validator
      *
      * @return mixed
      */
-    protected function checkValue($value, array $rules, $field)
+    protected function checkValue($value, array $rules, string $field)
     {
         foreach ($rules as $validator => $attr) {
             // данные для обработчика ошибок
@@ -356,7 +356,7 @@ class Validator
      *
      * @throws RuntimeException
      */
-    public function addError($error, $type = 'v')
+    public function addError($error, string $type = 'v'): void
     {
         if (empty($vars = \end($this->curData))) {
             throw new RuntimeException('The array of variables is empty');
@@ -395,7 +395,7 @@ class Validator
      *
      * @return mixed
      */
-    protected function getArguments($field, $rule)
+    protected function getArguments(string $field, string $rule)
     {
         if (isset($this->arguments[$field . '.' . $rule])) {
             return $this->arguments[$field . '.' . $rule];
@@ -413,7 +413,7 @@ class Validator
      *
      * @return bool
      */
-    public function getStatus($field)
+    public function getStatus(string $field): bool
     {
         if (! isset($this->status[$field])) {
             $this->__get($field);
@@ -431,7 +431,7 @@ class Validator
      *
      * @return array
      */
-    public function getData($all = false)
+    public function getData(bool $all = false): array
     {
         if (empty($this->status)) {
             throw new RuntimeException('Data not found');
@@ -451,7 +451,7 @@ class Validator
      *
      * @return array
      */
-    public function getErrors()
+    public function getErrors(): array
     {
         return $this->errors;
     }
@@ -786,12 +786,12 @@ class Validator
 
         if (\is_array($value)) {
             foreach ($value as $file) {
-                if (false === $this->c->Files->isImage($file)) {
+                if (null === $this->c->Files->isImage($file)) {
                     $this->addError('The :alias not contains image');
                     return null;
                 }
             }
-        } elseif (null !== $value && false === $this->c->Files->isImage($value)) {
+        } elseif (null !== $value && null === $this->c->Files->isImage($value)) {
             $this->addError('The :alias not contains image');
             return null;
         }

+ 1 - 1
app/Core/Validators.php

@@ -31,7 +31,7 @@ abstract class Validators
      *
      * @throws RuntimeException
      */
-    public function __call($name, array $args)
+    public function __call(string $name, array $args)
     {
         throw new RuntimeException($name . ' validator not found');
     }

+ 1 - 1
app/Core/View.php

@@ -85,7 +85,7 @@ EOD;
      *
      * @return null|string
      */
-    public function rendering(Page $p)
+    public function rendering(Page $p): ?string
     {
         foreach ($p->httpHeaders as $header) {
             \header($header[0], $header[1]);

+ 3 - 3
app/Models/Action.php

@@ -31,12 +31,12 @@ class Action
 
     /**
      * Объявление менеджера
-     * 
+     *
      * @param ManagerModel $manager
-     * 
+     *
      * @return Action
      */
-    public function setManager(ManagerModel $manager)
+    public function setManager(ManagerModel $manager): self
     {
         $this->manager = $manager;
         return $this;

+ 2 - 2
app/Models/AdminList/Model.php

@@ -11,7 +11,7 @@ class Model extends ParentModel
      *
      * @return AdminList\Model
      */
-    public function init()
+    public function init(): self
     {
         if ($this->c->Cache->has('admins')) {
             $this->list = $this->c->Cache->get('admins');
@@ -27,7 +27,7 @@ class Model extends ParentModel
      *
      * @return AdminList\Model
      */
-    public function reset()
+    public function reset(): self
     {
         $this->c->Cache->delete('admins');
         return $this;

+ 1 - 1
app/Models/BanList/Check.php

@@ -15,7 +15,7 @@ class Check extends Method
      *
      * @return bool
      */
-    public function check(User $user)
+    public function check(User $user): bool
     {
         // админ
         if ($user->isAdmin) {

+ 2 - 1
app/Models/BanList/Delete.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\BanList;
 
 use ForkBB\Models\Method;
+use ForkBB\Models\BanList\Model;
 
 class Delete extends Method
 {
@@ -14,7 +15,7 @@ class Delete extends Method
      *
      * @return BanList\Model
      */
-    public function delete(array $ids)
+    public function delete(array $ids): Model
     {
         if (! empty($ids)) {
             $vars = [

+ 1 - 1
app/Models/BanList/Filter.php

@@ -18,7 +18,7 @@ class Filter extends Method
      *
      * @return array
      */
-    public function filter(array $filters, array $order = [])
+    public function filter(array $filters, array $order = []): array
     {
         $fields  = $this->c->dbMap->bans;
         $orderBy = [];

+ 1 - 1
app/Models/BanList/GetList.php

@@ -13,7 +13,7 @@ class GetList extends Method
      *
      * @return array
      */
-    public function getList(array $ids)
+    public function getList(array $ids): array
     {
         $vars = [
             ':ids' => $ids,

+ 2 - 1
app/Models/BanList/Insert.php

@@ -4,6 +4,7 @@ namespace ForkBB\Models\BanList;
 
 use ForkBB\Models\Method;
 use InvalidArgumentException;
+use ForkBB\Models\BanList\Model;
 
 class Insert extends Method
 {
@@ -14,7 +15,7 @@ class Insert extends Method
      *
      * @return BanList\Model
      */
-    public function insert(array $ban)
+    public function insert(array $ban): Model
     {
         if (isset($ban['id'])
             || ! isset($ban['username'])

+ 1 - 1
app/Models/BanList/IsBanned.php

@@ -14,7 +14,7 @@ class IsBanned extends Method
      *
      * @return int
      */
-    public function isBanned(User $user)
+    public function isBanned(User $user): int
     {
         $name  = $this->model->trimToNull($user->username, true);
         // бан имени пользователя

+ 2 - 1
app/Models/BanList/Load.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\BanList;
 
 use ForkBB\Models\Method;
+use ForkBB\Models\BanList\Model;
 
 class Load extends Method
 {
@@ -12,7 +13,7 @@ class Load extends Method
      *
      * @return BanList\Model
      */
-    public function load()
+    public function load(): Model
     {
         $userList  = [];
         $emailList = [];

+ 3 - 3
app/Models/BanList/Model.php

@@ -11,7 +11,7 @@ class Model extends ParentModel
      *
      * @return BanList\Model
      */
-    public function init()
+    public function init(): self
     {
         if ($this->c->Cache->has('banlist')) {
             $list = $this->c->Cache->get('banlist');
@@ -39,7 +39,7 @@ class Model extends ParentModel
      *
      * @return null|string
      */
-    public function trimToNull($val, $toLower = false)
+    public function trimToNull($val, bool $toLower = false): ?string
     {
         $val = \trim($val);
         if ($val == '') {
@@ -58,7 +58,7 @@ class Model extends ParentModel
      *
      * @return string
      */
-    public function ip2hex($ip)
+    public function ip2hex(string $ip): string
     {
         $bin = \inet_pton($ip);
 

+ 2 - 1
app/Models/BanList/Update.php

@@ -4,6 +4,7 @@ namespace ForkBB\Models\BanList;
 
 use ForkBB\Models\Method;
 use InvalidArgumentException;
+use ForkBB\Models\BanList\Model;
 
 class Update extends Method
 {
@@ -14,7 +15,7 @@ class Update extends Method
      *
      * @return BanList\Model
      */
-    public function update(array $ban)
+    public function update(array $ban): Model
     {
         if (empty($ban['id'])
             || ! isset($ban['username'])

+ 8 - 6
app/Models/Categories/Manager.php

@@ -21,7 +21,7 @@ class Manager extends ManagerModel
      *
      * @return Manager
      */
-    public function init()
+    public function init(): self
     {
         $sql = 'SELECT c.id, c.cat_name, c.disp_position
                 FROM ::categories AS c
@@ -30,12 +30,12 @@ class Manager extends ManagerModel
         return $this;
     }
 
-    public function getList()
+    public function getList(): array
     {
         return $this->repository;
     }
 
-    public function set($key, $value)
+    public function set($key, $value): self
     {
         if (! isset($value['cat_name'], $value['disp_position'])) {
             throw new InvalidArgumentException('Expected array with cat_name and disp_position elements');
@@ -52,9 +52,11 @@ class Manager extends ManagerModel
         if ($old != $value) {
             $this->modified[$key] = true;
         }
+
+        return $this;
     }
 
-    public function update()
+    public function update(): self
     {
         foreach ($this->modified as $key => $value) {
             $cat = $this->get($key);
@@ -73,7 +75,7 @@ class Manager extends ManagerModel
         return $this;
     }
 
-    public function insert($name)
+    public function insert(string $name): int
     {
         $pos = 0;
         foreach ($this->repository as $cat) {
@@ -98,7 +100,7 @@ class Manager extends ManagerModel
         return $cid;
     }
 
-    public function delete($cid)
+    public function delete(int $cid): self
     {
         $root = $this->c->forums->get(0);
         $del  = [];

+ 1 - 1
app/Models/Censorship/Load.php

@@ -12,7 +12,7 @@ class Load extends Method
      *
      * @return array
      */
-    public function load()
+    public function load(): array
     {
         $sql = 'SELECT ce.id, ce.search_for, ce.replace_with
                 FROM ::censoring AS ce

+ 2 - 2
app/Models/Censorship/Model.php

@@ -11,7 +11,7 @@ class Model extends ParentModel
      *
      * @return Censorship\Model
      */
-    public function init()
+    public function init(): self
     {
         if ('1' == $this->c->config->o_censoring) {
             if ($this->c->Cache->has('censorship')) {
@@ -32,7 +32,7 @@ class Model extends ParentModel
      *
      * @return string
      */
-    public function censor($str)
+    public function censor(string $str): string
     {
         if ('1' == $this->c->config->o_censoring) {
             return (string) \preg_replace($this->searchList, $this->replaceList,  $str);

+ 2 - 1
app/Models/Censorship/Refresh.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Censorship;
 
 use ForkBB\Models\Method;
+use ForkBB\Models\Censorship\Model;
 
 class Refresh extends Method
 {
@@ -12,7 +13,7 @@ class Refresh extends Method
      *
      * @return Censorship
      */
-    public function refresh()
+    public function refresh(): Model
     {
         $stmt = $this->c->DB->query('SELECT ce.id, ce.search_for, ce.replace_with FROM ::censoring AS ce');
         $search  = [];

+ 2 - 1
app/Models/Censorship/Save.php

@@ -4,6 +4,7 @@ namespace ForkBB\Models\Censorship;
 
 use ForkBB\Models\Method;
 use PDO;
+use ForkBB\Models\Censorship\Model;
 
 class Save extends Method
 {
@@ -14,7 +15,7 @@ class Save extends Method
      *
      * @return Censorship
      */
-    public function save(array $list)
+    public function save(array $list): Model
     {
         $words  = $this->model->load();
         $forDel = [];

+ 2 - 1
app/Models/Config/Install.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Config;
 
 use ForkBB\Models\Method;
+use ForkBB\Models\Config\Model;
 
 class Install extends Method
 {
@@ -11,7 +12,7 @@ class Install extends Method
      *
      * @return Config
      */
-    public function install()
+    public function install(): Model
     {
         $this->model->setAttrs($this->c->forConfig);
         return $this->model;

+ 2 - 1
app/Models/Config/Load.php

@@ -4,6 +4,7 @@ namespace ForkBB\Models\Config;
 
 use ForkBB\Models\Method;
 use PDO;
+use ForkBB\Models\Config\Model;
 
 class Load extends Method
 {
@@ -13,7 +14,7 @@ class Load extends Method
      *
      * @return Config
      */
-    public function load()
+    public function load(): Model
     {
         $config = $this->c->DB->query('SELECT cf.conf_name, cf.conf_value FROM ::config AS cf')->fetchAll(PDO::FETCH_KEY_PAIR);
         $this->model->setAttrs($config);

+ 1 - 1
app/Models/Config/Model.php

@@ -11,7 +11,7 @@ class Model extends DataModel
      *
      * @return Config\Model
      */
-    public function init()
+    public function init(): self
     {
         if ($this->c->Cache->has('config')) {
             $this->setAttrs($this->c->Cache->get('config'));

+ 2 - 1
app/Models/Config/Save.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Config;
 
 use ForkBB\Models\Method;
+use ForkBB\Models\Config\Model;
 
 class Save extends Method
 {
@@ -12,7 +13,7 @@ class Save extends Method
      *
      * @return Config
      */
-    public function save()
+    public function save(): Model
     {
         $modified = $this->model->getModified();
         if (empty($modified)) {

+ 8 - 8
app/Models/Cookie/Model.php

@@ -53,7 +53,7 @@ class Model extends ParentModel
      *
      * @return bool
      */
-    public function set($name, $value, $expire = 0, $path = null, $domain = null, $secure = false, $httponly = true)
+    public function set(string $name, string $value, int $expire = 0, string $path = null, string $domain = null, bool $secure = false, bool $httponly = true): bool
     {
         $result = \setcookie(
             $this->prefix . $name,
@@ -78,7 +78,7 @@ class Model extends ParentModel
      *
      * @return mixed
      */
-    public function get($name, $default = null)
+    public function get(string $name, $default = null)
     {
         $name = $this->prefix . $name;
         return isset($_COOKIE[$name]) ? $this->c->Secury->replInvalidChars($_COOKIE[$name]) : $default;
@@ -93,7 +93,7 @@ class Model extends ParentModel
      *
      * @return bool
      */
-    public function delete($name, $path = null, $domain = null)
+    public function delete(string $name, string $path = null, string $domain = null): bool
     {
         $result = $this->set($name, '', 1, $path, $domain);
         if ($result) {
@@ -105,7 +105,7 @@ class Model extends ParentModel
     /**
      * Выделяет данные из куки аутентификации пользователя
      */
-    protected function init()
+    protected function init(): void
     {
         $ckUser = $this->get(self::NAME);
 
@@ -138,7 +138,7 @@ class Model extends ParentModel
      *
      * @return bool
      */
-    public function verifyUser(User $user)
+    public function verifyUser(User $user): bool
     {
         return $this->uId === (int) $user->id
             && \hash_equals(
@@ -155,7 +155,7 @@ class Model extends ParentModel
      *
      * @return bool
      */
-    public function setUser(User $user, $remember = null)
+    public function setUser(User $user, bool $remember = null): bool
     {
         if ($user->isGuest) {
             return $this->deleteUser();
@@ -186,7 +186,7 @@ class Model extends ParentModel
      *
      * @return bool
      */
-    public function deleteUser()
+    public function deleteUser(): bool
     {
         if (null === $this->get(self::NAME)) {
             return true;
@@ -203,7 +203,7 @@ class Model extends ParentModel
      *
      * @throws RuntimeException
      */
-    public function __set($name, $val)
+    public function __set(string $name, $val): void
     {
         if ($this->noSet) {
             throw new RuntimeException('Model attributes in read-only mode');

+ 2 - 2
app/Models/DBMap/Model.php

@@ -11,7 +11,7 @@ class Model extends ParentModel
      *
      * @return DBMap\Model
      */
-    public function init()
+    public function init(): self
     {
         if ($this->c->Cache->has('db_map')) {
             $this->setAttrs($this->c->Cache->get('db_map'));
@@ -28,7 +28,7 @@ class Model extends ParentModel
      *
      * @return DBMap\Model
      */
-    public function reset()
+    public function reset(): self
     {
         $this->c->Cache->delete('db_map');
         return $this;

+ 7 - 7
app/Models/DataModel.php

@@ -29,7 +29,7 @@ class DataModel extends Model
      *
      * @return DataModel
      */
-    public function setAttrs(array $attrs)
+    public function setAttrs(array $attrs): self
     {
         $this->zModFlags   = [];
         $this->zTrackFlags = [];
@@ -46,7 +46,7 @@ class DataModel extends Model
      *
      * @return DataModel
      */
-    public function replAttrs(array $attrs, $setFlags = false)
+    public function replAttrs(array $attrs, bool $setFlags = false): self
     {
         foreach ($attrs as $name => $value) {
             $this->__set($name, $value);
@@ -64,7 +64,7 @@ class DataModel extends Model
      *
      * @return array
      */
-    public function getAttrs()
+    public function getAttrs(): array
     {
         return $this->zAttrs; //????
     }
@@ -74,7 +74,7 @@ class DataModel extends Model
      *
      * @return array
      */
-    public function getModified()
+    public function getModified(): array
     {
         return \array_keys($this->zModFlags);
     }
@@ -82,7 +82,7 @@ class DataModel extends Model
     /**
      * Обнуляет массив флагов измененных свойств модели
      */
-    public function resModified()
+    public function resModified(): void
     {
         $this->zModFlags   = [];
         $this->zTrackFlags = [];
@@ -94,7 +94,7 @@ class DataModel extends Model
      * @param string $name
      * @param mixed $value
      */
-    public function __set($name, $value)
+    public function __set(string $name, $value): void
     {
         // без отслеживания
         if (\strpos($name, '__') === 0) {
@@ -137,7 +137,7 @@ class DataModel extends Model
      *
      * @return mixed
      */
-    public function __get($name)
+    public function __get(string $name)
     {
         // без вычисления
         if (\strpos($name, '__') === 0) {

+ 2 - 1
app/Models/Forum/CalcStat.php

@@ -4,6 +4,7 @@ namespace ForkBB\Models\Forum;
 
 use ForkBB\Models\Method;
 use RuntimeException;
+use ForkBB\Models\Forum\Model;
 
 class CalcStat extends Method
 {
@@ -14,7 +15,7 @@ class CalcStat extends Method
      *
      * @return Forum
      */
-    public function calcStat()
+    public function calcStat(): Model
     {
         if ($this->model->id < 1) {
             throw new RuntimeException('The model does not have ID');

+ 1 - 1
app/Models/Forum/Delete.php

@@ -18,7 +18,7 @@ class Delete extends Action
      * @throws InvalidArgumentException
      * @throws RuntimeException
      */
-    public function delete(...$args)
+    public function delete(...$args): void
     {
         if (empty($args)) {
             throw new InvalidArgumentException('No arguments, expected User(s) or Forum(s)');

+ 4 - 3
app/Models/Forum/LoadTree.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Forum;
 
 use ForkBB\Models\Action;
+use ForkBB\Models\Forum\Model;
 
 class LoadTree extends Action
 {
@@ -13,7 +14,7 @@ class LoadTree extends Action
      *
      * @return null|Forum
      */
-    public function loadTree($rootId)
+    public function loadTree(int $rootId): ?Model
     {
         $root = $this->manager->get($rootId);
         if (null === $root) {
@@ -44,7 +45,7 @@ class LoadTree extends Action
      *
      * @param array $list
      */
-    protected function loadData(array $list)
+    protected function loadData(array $list): void
     {
         if (empty($list)) {
             return;
@@ -88,7 +89,7 @@ class LoadTree extends Action
      *
      * @param array $list
      */
-    protected function checkForNew(array $list)
+    protected function checkForNew(array $list): void
     {
         if (empty($list) || $this->c->user->isGuest) {
             return;

+ 6 - 6
app/Models/Forum/Manager.php

@@ -22,7 +22,7 @@ class Manager extends ManagerModel
      *
      * @return Forum
      */
-    public function create(array $attrs = [])
+    public function create(array $attrs = []): Forum
     {
         return $this->c->ForumModel->setAttrs($attrs);
     }
@@ -34,7 +34,7 @@ class Manager extends ManagerModel
      *
      * @return Manager
      */
-    public function init(Group $group = null)
+    public function init(Group $group = null): self
     {
         if (null === $group) {
             $gid = $this->c->user->group_id;
@@ -66,7 +66,7 @@ class Manager extends ManagerModel
      *
      * @return null|Forum
      */
-    public function get($id)
+    public function get($id): ?Forum
     {
         $forum = parent::get($id);
 
@@ -88,7 +88,7 @@ class Manager extends ManagerModel
      *
      * @return Forum
      */
-    public function update(Forum $forum)
+    public function update(Forum $forum): Forum
     {
         return $this->Save->update($forum);
     }
@@ -100,7 +100,7 @@ class Manager extends ManagerModel
      *
      * @return int
      */
-    public function insert(Forum $forum)
+    public function insert(Forum $forum): int
     {
         $id = $this->Save->insert($forum);
         $this->set($id, $forum);
@@ -116,7 +116,7 @@ class Manager extends ManagerModel
      *
      * @return array
      */
-    public function depthList(Forum $forum, $depth, array $list = [])
+    public function depthList(Forum $forum, int $depth, array $list = []): array
     {
         ++$depth;
         foreach ($forum->subforums as $sub) {

+ 1 - 1
app/Models/Forum/Markread.php

@@ -18,7 +18,7 @@ class Markread extends Action
      *
      * @return Forum
      */
-    public function markread(Forum $forum, User $user)
+    public function markread(Forum $forum, User $user): Forum
     {
         if ($user->isGuest) {
             throw new RuntimeException('Expected user, not guest');

+ 20 - 19
app/Models/Forum/Model.php

@@ -4,6 +4,7 @@ namespace ForkBB\Models\Forum;
 
 use ForkBB\Models\DataModel;
 use ForkBB\Models\User\Model as User;
+use ForkBB\Models\Forum\Model as Forum;
 use RuntimeException;
 use InvalidArgumentException;
 use PDO;
@@ -17,7 +18,7 @@ class Model extends DataModel
      *
      * @return Forum\Model
      */
-    protected function getparent()
+    protected function getparent(): ?Forum
     {
         if (null === $this->parent_forum_id && $this->id !== 0) {
             throw new RuntimeException('Parent is not defined');
@@ -31,7 +32,7 @@ class Model extends DataModel
      *
      * @return bool
      */
-    protected function getcanCreateTopic()
+    protected function getcanCreateTopic(): bool
     {
         $user = $this->c->user;
         return $this->post_topics == 1
@@ -45,7 +46,7 @@ class Model extends DataModel
      *
      * @return bool
      */
-    protected function getcanMarkRead()
+    protected function getcanMarkRead(): bool
     {
         return ! $this->c->user->isGuest; // ????
     }
@@ -55,7 +56,7 @@ class Model extends DataModel
      *
      * @return array
      */
-    protected function getsubforums()
+    protected function getsubforums(): array
     {
         $sub = [];
         $attr = $this->getAttr('subforums');
@@ -74,7 +75,7 @@ class Model extends DataModel
      *
      * @return array
      */
-    protected function getdescendants()
+    protected function getdescendants(): array
     {
         $all = [];
         $attr = $this->getAttr('descendants');
@@ -93,7 +94,7 @@ class Model extends DataModel
      *
      * @return string
      */
-    protected function getlink()
+    protected function getlink(): string
     {
         if (0 === $this->id) {
             return $this->c->Router->link('Index');
@@ -107,7 +108,7 @@ class Model extends DataModel
      *
      * @return string
      */
-    protected function getlinkNew()
+    protected function getlinkNew(): string
     {
         if (0 === $this->id) {
             return $this->c->Router->link('SearchAction', ['action' => 'new']);
@@ -121,7 +122,7 @@ class Model extends DataModel
      *
      * @return null|string
      */
-    protected function getlinkLast()
+    protected function getlinkLast(): ?string
     {
         if ($this->last_post_id < 1) {
             return null;
@@ -135,7 +136,7 @@ class Model extends DataModel
      *
      * @return string
      */
-    protected function getlinkCreateTopic()
+    protected function getlinkCreateTopic(): string
     {
         return $this->c->Router->link('NewTopic', ['id' => $this->id]);
     }
@@ -145,7 +146,7 @@ class Model extends DataModel
      *
      * @return string
      */
-    protected function getlinkMarkRead()
+    protected function getlinkMarkRead(): string
     {
         return $this->c->Router->link('MarkRead', [
                 'id'    => $this->id,
@@ -158,7 +159,7 @@ class Model extends DataModel
      *
      * @return array
      */
-    protected function getmoderators()
+    protected function getmoderators(): array
     {
         $attr = $this->getAttr('moderators');
         if (empty($attr) || ! \is_array($attr)) {
@@ -188,7 +189,7 @@ class Model extends DataModel
      *
      * @throws InvalidArgumentException
      */
-    public function modAdd(...$users)
+    public function modAdd(...$users): void
     {
         $attr = $this->getAttr('moderators');
         if (empty($attr) || ! \is_array($attr)) {
@@ -212,7 +213,7 @@ class Model extends DataModel
      *
      * @throws InvalidArgumentException
      */
-    public function modDelete(...$users)
+    public function modDelete(...$users): void
     {
         $attr = $this->getAttr('moderators');
         if (empty($attr) || ! \is_array($attr)) {
@@ -234,7 +235,7 @@ class Model extends DataModel
      *
      * @return Forum\Model
      */
-    protected function gettree()
+    protected function gettree(): Forum
     {
         $attr = $this->getAttr('tree');
 
@@ -279,7 +280,7 @@ class Model extends DataModel
      *
      * @return int
      */
-    protected function getnumPages()
+    protected function getnumPages(): int
     {
         if (null === $this->num_topics) {
             throw new RuntimeException('The model does not have the required data');
@@ -293,7 +294,7 @@ class Model extends DataModel
      *
      * @return array
      */
-    protected function getpagination()
+    protected function getpagination(): array
     {
         return $this->c->Func->paginate($this->numPages, $this->page, 'Forum', ['id' => $this->id, 'name' => $this->forum_name]);
     }
@@ -303,7 +304,7 @@ class Model extends DataModel
      *
      * @return bool
      */
-    public function hasPage()
+    public function hasPage(): bool
     {
         return $this->page > 0 && $this->page <= $this->numPages;
     }
@@ -315,7 +316,7 @@ class Model extends DataModel
      *
      * @return array
      */
-    public function pageData()
+    public function pageData(): array
     {
         if (! $this->hasPage()) {
             throw new InvalidArgumentException('Bad number of displayed page');
@@ -358,7 +359,7 @@ class Model extends DataModel
      *
      * @return array
      */
-    public function getAttrs()
+    public function getAttrs(): array
     {
         $data = parent::getAttrs();
 

+ 3 - 3
app/Models/Forum/Refresh.php

@@ -20,7 +20,7 @@ class Refresh extends Action
      *
      * @return array
      */
-    public function refresh(Group $group = null)
+    public function refresh(Group $group = null): array
     {
         if (null === $group) {
             $gid  = $this->c->user->group_id;
@@ -68,7 +68,7 @@ class Refresh extends Action
      *
      * @return null|array
      */
-    protected function formatModers($str)
+    protected function formatModers(string $str): ?array
     {
         $moderators = \json_decode($str, true);
         return $moderators ?: null;
@@ -82,7 +82,7 @@ class Refresh extends Action
      *
      * @return array
      */
-    protected function createList(array $list, $parent = 0)
+    protected function createList(array $list, int $parent = 0): array
     {
         $sub = [];
         $all = [];

+ 2 - 2
app/Models/Forum/Save.php

@@ -17,7 +17,7 @@ class Save extends Action
      *
      * @return Forum
      */
-    public function update(Forum $forum)
+    public function update(Forum $forum): Forum
     {
         if ($forum->id < 1) {
             throw new RuntimeException('The model does not have ID');
@@ -71,7 +71,7 @@ class Save extends Action
      *
      * @return int
      */
-    public function insert(Forum $forum)
+    public function insert(Forum $forum): int
     {
         if (null !== $forum->id) {
             throw new RuntimeException('The model has ID');

+ 1 - 1
app/Models/Group/Delete.php

@@ -18,7 +18,7 @@ class Delete extends Action
      * @throws InvalidArgumentException
      * @throws RuntimeException
      */
-    public function delete(Group $group, Group $new = null)
+    public function delete(Group $group, Group $new = null): void
     {
         if (null !== $new) {
             $this->c->users->promote($group, $new);

+ 6 - 6
app/Models/Group/Manager.php

@@ -21,12 +21,12 @@ class Manager extends ManagerModel
      *
      * @return Group
      */
-    public function create(array $attrs = [])
+    public function create(array $attrs = []): Group
     {
         return $this->c->GroupModel->setAttrs($attrs);
     }
 
-    public function getList()
+    public function getList(): array
     {
         return $this->repository;
     }
@@ -36,7 +36,7 @@ class Manager extends ManagerModel
      *
      * @return Manager
      */
-    public function init()
+    public function init(): self
     {
         if (empty($this->flag)) {
             $stmt = $this->c->DB->query('SELECT g.* FROM ::groups AS g ORDER BY g.g_id');
@@ -55,7 +55,7 @@ class Manager extends ManagerModel
      *
      * @return null|Group
      */
-    public function get($id)
+    public function get($id): ?Group
     {
         $group = parent::get($id);
 
@@ -69,7 +69,7 @@ class Manager extends ManagerModel
      *
      * @return Group
      */
-    public function update(Group $group)
+    public function update(Group $group): Group
     {
         return $this->Save->update($group);
     }
@@ -81,7 +81,7 @@ class Manager extends ManagerModel
      *
      * @return int
      */
-    public function insert(Group $group)
+    public function insert(Group $group): int
     {
         $id = $this->Save->insert($group);
         $this->set($id, $group);

+ 6 - 6
app/Models/Group/Model.php

@@ -8,12 +8,12 @@ use InvalidArgumentException;
 
 class Model extends DataModel
 {
-    protected function getlinkEdit()
+    protected function getlinkEdit(): string
     {
         return $this->c->Router->link('AdminGroupsEdit', ['id' => $this->g_id]);
     }
 
-    protected function getcanDelete()
+    protected function getcanDelete(): bool
     {
         $notDeleted = [
             $this->c->GROUP_ADMIN,
@@ -24,22 +24,22 @@ class Model extends DataModel
         return ! \in_array($this->g_id, $notDeleted) && $this->g_id != $this->c->config->o_default_user_group;
     }
 
-    protected function getlinkDelete()
+    protected function getlinkDelete(): ?string
     {
         return $this->canDelete ? $this->c->Router->link('AdminGroupsDelete', ['id' => $this->g_id]) : null;
     }
 
-    protected function getgroupGuest()
+    protected function getgroupGuest(): bool
     {
         return $this->g_id === $this->c->GROUP_GUEST;
     }
 
-    protected function getgroupMember()
+    protected function getgroupMember(): bool
     {
         return $this->g_id === $this->c->GROUP_MEMBER;
     }
 
-    protected function getgroupAdmin()
+    protected function getgroupAdmin(): bool
     {
         return $this->g_id === $this->c->GROUP_ADMIN;
     }

+ 5 - 5
app/Models/Group/Perm.php

@@ -24,7 +24,7 @@ class Perm extends Action
      *
      * @return array
      */
-    public function get(Forum $forum)
+    public function get(Forum $forum): array
     {
         $vars = [
             ':fid' => $forum->id > 0 ? $forum->id : 0,
@@ -66,7 +66,7 @@ class Perm extends Action
      *
      * @throws RuntimeException
      */
-    public function update(Forum $forum, array $perms)
+    public function update(Forum $forum, array $perms): void
     {
         if ($forum->id < 1) {
             throw new RuntimeException('The forum does not have ID');
@@ -122,7 +122,7 @@ class Perm extends Action
      *
      * @throws RuntimeException
      */
-    public function reset(Forum $forum)
+    public function reset(Forum $forum): void
     {
         if ($forum->id < 1) {
             throw new RuntimeException('The forum does not have ID');
@@ -143,7 +143,7 @@ class Perm extends Action
      *
      * @throws RuntimeException
      */
-    public function delete(Group $group)
+    public function delete(Group $group): void
     {
         if ($group->g_id < 1) {
             throw new RuntimeException('The group does not have ID');
@@ -165,7 +165,7 @@ class Perm extends Action
      *
      * @throws RuntimeException
      */
-    public function copy(Group $from, Group $to)
+    public function copy(Group $from, Group $to): void
     {
         if ($from->g_id < 1 || $to->g_id < 1) {
             throw new RuntimeException('The group does not have ID');

+ 2 - 2
app/Models/Group/Save.php

@@ -17,7 +17,7 @@ class Save extends Action
      *
      * @return Group
      */
-    public function update(Group $group)
+    public function update(Group $group): Group
     {
         if ($group->g_id < 1) {
             throw new RuntimeException('The model does not have ID');
@@ -55,7 +55,7 @@ class Save extends Action
      *
      * @return int
      */
-    public function insert(Group $group)
+    public function insert(Group $group): int
     {
         if (null !== $group->g_id) {
             throw new RuntimeException('The model has ID');

+ 3 - 3
app/Models/ManagerModel.php

@@ -16,7 +16,7 @@ class ManagerModel extends Model
         return isset($this->repository[$key]) ? $this->repository[$key] : null;
     }
 
-    public function set($key, $value)
+    public function set($key, $value): self
     {
         $this->repository[$key] = $value;
 
@@ -30,7 +30,7 @@ class ManagerModel extends Model
      *
      * @return mixed
      */
-    public function __get($name)
+    public function __get(string $name)
     {
         $key = \str_replace(['ForkBB\\Models\\', 'ForkBB\\', '\\'], '', \get_class($this));
 
@@ -45,7 +45,7 @@ class ManagerModel extends Model
      *
      * @return mixed
      */
-    public function __call($name, array $args)
+    public function __call(string $name, array $args)
     {
         return $this->__get($name)->$name(...$args);
     }

+ 3 - 3
app/Models/Method.php

@@ -31,12 +31,12 @@ class Method
 
     /**
      * Объявление модели
-     * 
+     *
      * @param Model $model
-     * 
+     *
      * @return Method
      */
-    public function setModel(Model $model)
+    public function setModel(Model $model): self
     {
         $this->model = $model;
         return $this;

+ 9 - 9
app/Models/Model.php

@@ -48,7 +48,7 @@ class Model
      *
      * @return bool
      */
-    public function __isset($name)
+    public function __isset($name): bool
     {
         return \array_key_exists($name, $this->zAttrs)
             || \array_key_exists($name, $this->zAttrsCalc)
@@ -60,7 +60,7 @@ class Model
      *
      * @param mixed $name
      */
-    public function __unset($name)
+    public function __unset($name): void
     {
         unset($this->zAttrs[$name]);
         $this->unsetCalc($name);
@@ -71,7 +71,7 @@ class Model
      *
      * @param mixed $name
      */
-    protected function unsetCalc($name)
+    protected function unsetCalc($name): void
     {
         unset($this->zAttrsCalc[$name]); //????
 
@@ -86,7 +86,7 @@ class Model
      * @param string $name
      * @param mixed $value
      */
-    public function __set($name, $value)
+    public function __set(string $name, $value): void
     {
         $this->unsetCalc($name);
 
@@ -106,7 +106,7 @@ class Model
      *
      * @return Model
      */
-    public function setAttr($name, $value)
+    public function setAttr(string $name, $value): self
     {
         $this->unsetCalc($name);
         $this->zAttrs[$name] = $value;
@@ -122,7 +122,7 @@ class Model
      *
      * @return Model
      */
-    public function setAttrs(array $attrs)
+    public function setAttrs(array $attrs): self
     {
         $this->zAttrs      = $attrs; //????
         $this->zAttrsCalc  = [];
@@ -137,7 +137,7 @@ class Model
      *
      * @return mixed
      */
-    public function __get($name)
+    public function __get(string $name)
     {
         if (\array_key_exists($name, $this->zAttrsCalc)) {
             return $this->zAttrsCalc[$name];
@@ -157,7 +157,7 @@ class Model
      *
      * @return mixed
      */
-    public function getAttr($name, $default = null)
+    public function getAttr(string $name, $default = null)
     {
         return \array_key_exists($name, $this->zAttrs) ? $this->zAttrs[$name] : $default;
     }
@@ -170,7 +170,7 @@ class Model
      *
      * @return mixed
      */
-    public function __call($name, array $args)
+    public function __call(string $name, array $args)
     {
         $key = \str_replace(['ForkBB\\Models\\', 'ForkBB\\', '\\'], '', \get_class($this));
 

+ 2 - 1
app/Models/Online/Info.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Online;
 
 use ForkBB\Models\Method;
+use ForkBB\Models\Online\Model as Online;
 
 class Info extends Method
 {
@@ -11,7 +12,7 @@ class Info extends Method
      *
      * @return null|Online\Model
      */
-    public function info()
+    public function info(): ?Online
     {
         if (! $this->model->detail) {
             return null;

+ 3 - 3
app/Models/Online/Model.php

@@ -17,7 +17,7 @@ class Model extends ParentModel
      *
      * @return Online\Model
      */
-    public function calc(Page $page)
+    public function calc(Page $page): self
     {
         if ($this->done) {
             return $this;
@@ -138,7 +138,7 @@ class Model extends ParentModel
      *
      * @param string $position
      */
-    protected function updateUser($position)
+    protected function updateUser(string $position): void
     {
         // гость
         if ($this->c->user->isGuest) {
@@ -174,7 +174,7 @@ class Model extends ParentModel
      *
      * @param User $user
      */
-    public function delete(User $user)
+    public function delete(User $user): void
     {
         if ($user->isGuest) {
             $this->c->DB->exec('DELETE FROM ::online WHERE user_id=1 AND ident=?s:ip', [':ip' => $user->ip]);

+ 12 - 12
app/Models/Page.php

@@ -43,7 +43,7 @@ abstract class Page extends Model
     /**
      * Подготовка страницы к отображению
      */
-    public function prepare()
+    public function prepare(): void
     {
         $this->fNavigation = $this->fNavigation();
         $this->maintenance();
@@ -54,7 +54,7 @@ abstract class Page extends Model
      *
      * @return array
      */
-    protected function fNavigation()
+    protected function fNavigation(): array
     {
         $r = $this->c->Router;
 
@@ -141,7 +141,7 @@ abstract class Page extends Model
     /**
      * Вывод информации о режиме обслуживания для админа
      */
-    protected function maintenance()
+    protected function maintenance(): void
     {
         if ($this->c->config->o_maintenance == '1' && $this->user->isAdmin) {
             $this->fIswev = ['w', \ForkBB\__('Maintenance mode enabled', $this->c->Router->link('AdminMaintenance'))];
@@ -160,7 +160,7 @@ abstract class Page extends Model
      *
      * @return string
      */
-    protected function getpageTitle(array $titles = [])
+    protected function getpageTitle(array $titles = []): string
     {
         if (empty($titles)) {
             $titles = $this->titles;
@@ -175,7 +175,7 @@ abstract class Page extends Model
      *
      * @return array
      */
-    protected function getpageHeaders()
+    protected function getpageHeaders(): array
     {
         $headers = [
             ['link', 'rel="stylesheet" type="text/css" href="' . $this->c->PUBLIC_URL . '/style/' . $this->user->style . '/style.css' . '"'],
@@ -205,7 +205,7 @@ abstract class Page extends Model
      *
      * @return Page
      */
-    public function addStyle($name, $value)
+    public function addStyle(string $name, string $value): self
     {
         $attr = $this->getAttr('pageHeaders', []);
         $attr['style'][$name] = $value;
@@ -222,7 +222,7 @@ abstract class Page extends Model
      *
      * @return Page
      */
-    public function header($key, $value, $replace = true)
+    public function header(string $key, string $value, $replace = true): self
     {
         if ('HTTP/' === \substr($key, 0, 5)) {
             if (\preg_match('%^HTTP/\d\.\d%', $_SERVER['SERVER_PROTOCOL'], $match)) {
@@ -245,7 +245,7 @@ abstract class Page extends Model
      *
      * @return array
      */
-    protected function gethttpHeaders()
+    protected function gethttpHeaders(): array
     {
         $now = gmdate('D, d M Y H:i:s') . ' GMT';
 
@@ -265,7 +265,7 @@ abstract class Page extends Model
      *
      * @return Page
      */
-    protected function httpStatus()
+    protected function httpStatus(): self
     {
         $list = [
             403 => '403 Forbidden',
@@ -287,7 +287,7 @@ abstract class Page extends Model
      *
      * @param string $value
      */
-    public function settitles($value)
+    public function settitles(string $value): void
     {
         $attr = $this->getAttr('titles', []);
         $attr[] = $value;
@@ -300,7 +300,7 @@ abstract class Page extends Model
      *
      * @param array $value
      */
-    public function setfIswev(array $value)
+    public function setfIswev(array $value): void
     {
         $attr = $this->getAttr('fIswev', []);
 
@@ -321,7 +321,7 @@ abstract class Page extends Model
      *
      * @return array
      */
-    protected function crumbs(...$crumbs)
+    protected function crumbs(...$crumbs): array
     {
         $result = [];
         $active = true;

+ 3 - 3
app/Models/Pages/Admin.php

@@ -32,7 +32,7 @@ class Admin extends Page
     /**
      * Подготовка страницы к отображению
      */
-    public function prepare()
+    public function prepare(): void
     {
         $this->aNavigation = $this->aNavigation();
         $this->crumbs      = $this->crumbs(...$this->aCrumbs);
@@ -45,7 +45,7 @@ class Admin extends Page
      *
      * @return array
      */
-    protected function aNavigation()
+    protected function aNavigation(): array
     {
         $r   = $this->c->Router;
         $nav = [
@@ -83,7 +83,7 @@ class Admin extends Page
      *
      * @return array
      */
-    protected function crumbs(...$crumbs)
+    protected function crumbs(...$crumbs): array
     {
         if ('index' !== $this->aIndex) {
             if (isset($this->aNavigation[$this->aIndex])) {

+ 13 - 12
app/Models/Pages/Admin/Bans.php

@@ -4,6 +4,7 @@ namespace ForkBB\Models\Pages\Admin;
 
 use ForkBB\Core\Container;
 use ForkBB\Core\Validator;
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Admin;
 use ForkBB\Models\User\Model as User;
 use RuntimeException;
@@ -31,7 +32,7 @@ class Bans extends Admin
      *
      * @return string
      */
-    protected function encodeData(array $data)
+    protected function encodeData(array $data): string
     {
         unset($data['token']);
         $data = \base64_encode(\json_encode($data));
@@ -46,7 +47,7 @@ class Bans extends Admin
      *
      * @return mixed
      */
-    protected function decodeData($data)
+    protected function decodeData(string $data)
     {
         $data = \explode(':', $data);
 
@@ -72,7 +73,7 @@ class Bans extends Admin
      *
      * @return Page
      */
-    public function view(array $args, $method, array $data = [])
+    public function view(array $args, string $method, array $data = []): Page
     {
         $this->nameTpl        = 'admin/bans';
         $this->formBanPage    = 'AdminBansNew';
@@ -128,7 +129,7 @@ class Bans extends Admin
      *
      * @return array
      */
-    protected function formSearch(array $data = [])
+    protected function formSearch(array $data = []): array
     {
         $form = [
             'action' => $this->c->Router->link('AdminBans'),
@@ -248,7 +249,7 @@ class Bans extends Admin
      *
      * @return array
      */
-    protected function formBan(array $data = [], array $args = [])
+    protected function formBan(array $data = [], array $args = []): array
     {
         $form = [
             'action' => $this->c->Router->link($this->formBanPage, $args),
@@ -334,7 +335,7 @@ class Bans extends Admin
      *
      * @return array
      */
-    protected function forFilter(array $data)
+    protected function forFilter(array $data): array
     {
         $order = [
             $data['order_by'] => $data['direction'],
@@ -376,7 +377,7 @@ class Bans extends Admin
      *
      * @return Page
      */
-    public function result(array $args, $method)
+    public function result(array $args, string $method): Page
     {
         $data = $this->decodeData($args['data']);
         if (false === $data) {
@@ -420,7 +421,7 @@ class Bans extends Admin
      *
      * @return array
      */
-    protected function form(array $bans, $number, array $args)
+    protected function form(array $bans, int $number, array $args): array
     {
         $form = [
             'sets'   => [],
@@ -545,7 +546,7 @@ class Bans extends Admin
      *
      * @return Page
      */
-    public function add(array $args, $method)
+    public function add(array $args, string $method): Page
     {
         $this->banCount = 0;
         $userList       = [];
@@ -604,7 +605,7 @@ class Bans extends Admin
      *
      * @return Page
      */
-    public function edit(array $args, $method)
+    public function edit(array $args, string $method): Page
     {
         $this->banCount = 1;
 
@@ -640,7 +641,7 @@ class Bans extends Admin
      *
      * @return Page
      */
-    protected function ban($isNew, array $args, $method, array $userList, array $data = [])
+    protected function ban(bool $isNew, array $args, string $method, array $userList, array $data = []): Page
     {
         if ('POST' === $method) {
             $v = $this->c->Validator->reset()
@@ -880,7 +881,7 @@ class Bans extends Admin
      *
      * @return Page
      */
-    public function delete(array $args, $method)
+    public function delete(array $args, string $method): Page
     {
         if (! $this->c->Csrf->verify($args['token'], 'AdminBansDelete', $args)) {
             return $this->c->Message->message('Bad token');

+ 5 - 4
app/Models/Pages/Admin/Categories.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Pages\Admin;
 
 use ForkBB\Core\Container;
+use ForkBB\Models\Page;
 use ForkBB\Models\Forum\Model as Forum;
 use ForkBB\Models\Pages\Admin;
 
@@ -16,7 +17,7 @@ class Categories extends Admin
      *
      * @return Page
      */
-    public function view(array $args, $method)
+    public function view(array $args, string $method): Page
     {
         $this->c->Lang->load('admin_categories');
 
@@ -64,7 +65,7 @@ class Categories extends Admin
      *
      * @return array
      */
-    protected function formEdit()
+    protected function formEdit(): array
     {
         $form = [
             'action' => $this->c->Router->link('AdminCategories'),
@@ -137,7 +138,7 @@ class Categories extends Admin
      *
      * @return Page
      */
-    public function delete(array $args, $method)
+    public function delete(array $args, string $method): Page
     {
         $category = $this->c->categories->get((int) $args['id']);
         if (! $category) {
@@ -187,7 +188,7 @@ class Categories extends Admin
      *
      * @return array
      */
-    protected function formDelete(array $args, array $category)
+    protected function formDelete(array $args, array $category): array
     {
         return [
             'action' => $this->c->Router->link('AdminCategoriesDelete', $args),

+ 3 - 2
app/Models/Pages/Admin/Censoring.php

@@ -2,6 +2,7 @@
 
 namespace ForkBB\Models\Pages\Admin;
 
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Admin;
 
 class Censoring extends Admin
@@ -14,7 +15,7 @@ class Censoring extends Admin
      *
      * @return Page
      */
-    public function edit(array $args, $method)
+    public function edit(array $args, string $method): Page
     {
         $this->c->Lang->load('admin_censoring');
 
@@ -56,7 +57,7 @@ class Censoring extends Admin
      *
      * @return array
      */
-    protected function formEdit()
+    protected function formEdit(): array
     {
         $form = [
             'action' => $this->c->Router->link('AdminCensoring'),

+ 9 - 8
app/Models/Pages/Admin/Forums.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Pages\Admin;
 
 use ForkBB\Core\Container;
+use ForkBB\Models\Page;
 use ForkBB\Models\Forum\Model as Forum;
 use ForkBB\Models\Pages\Admin;
 
@@ -13,7 +14,7 @@ class Forums extends Admin
      *
      * @param Forum $forum
      */
-    protected function calcList(Forum $forum)
+    protected function calcList(Forum $forum): void
     {
         $cid        = null;
         $categories = $this->c->categories->getList();
@@ -56,7 +57,7 @@ class Forums extends Admin
      *
      * @return int
      */
-    protected function forumPos(Forum $forum)
+    protected function forumPos(Forum $forum): int
     {
         if (\is_int($forum->disp_position)) {
             return $forum->disp_position;
@@ -85,7 +86,7 @@ class Forums extends Admin
      *
      * @return Page
      */
-    public function view(array $args, $method)
+    public function view(array $args, string $method): Page
     {
         $this->c->Lang->load('admin_forums');
 
@@ -128,7 +129,7 @@ class Forums extends Admin
      *
      * @return array
      */
-    protected function formView()
+    protected function formView(): array
     {
         $form = [
             'action' => $this->c->Router->link('AdminForums'),
@@ -214,7 +215,7 @@ class Forums extends Admin
      *
      * @return Page
      */
-    public function delete(array $args, $method)
+    public function delete(array $args, string $method): Page
     {
         $forum = $this->c->forums->get((int) $args['id']);
         if (! $forum instanceof Forum || $forum->subforums) {
@@ -264,7 +265,7 @@ class Forums extends Admin
      *
      * @return array
      */
-    protected function formDelete(array $args, Forum $forum)
+    protected function formDelete(array $args, Forum $forum): array
     {
         return [
             'action' => $this->c->Router->link('AdminForumsDelete', $args),
@@ -318,7 +319,7 @@ class Forums extends Admin
      *
      * @return Page
      */
-    public function edit(array $args, $method)
+    public function edit(array $args, string $method): Page
     {
         $this->c->Lang->load('admin_forums');
 
@@ -418,7 +419,7 @@ class Forums extends Admin
      *
      * @return array
      */
-    protected function formEdit(array $args, Forum $forum, $marker)
+    protected function formEdit(array $args, Forum $forum, string $marker): array
     {
         $form = [
             'action' => $this->c->Router->link($marker, $args),

+ 10 - 9
app/Models/Pages/Admin/Groups.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Pages\Admin;
 
 use ForkBB\Core\Container;
+use ForkBB\Models\Page;
 use ForkBB\Models\Group\Model as Group;
 use ForkBB\Models\Pages\Admin;
 
@@ -47,7 +48,7 @@ class Groups extends Admin
      *
      * @return Page
      */
-    public function view()
+    public function view(): Page
     {
         $this->nameTpl     = 'admin/groups';
         $this->formNew     = $this->formNew();
@@ -61,7 +62,7 @@ class Groups extends Admin
      *
      * @return array
      */
-    protected function formNew()
+    protected function formNew(): array
     {
         return [
             'action' => $this->c->Router->link('AdminGroupsNew'),
@@ -98,7 +99,7 @@ class Groups extends Admin
      *
      * @return array
      */
-    protected function formDefault()
+    protected function formDefault(): array
     {
         return [
             'action' => $this->c->Router->link('AdminGroupsDefault'),
@@ -134,7 +135,7 @@ class Groups extends Admin
      *
      * @return Page
      */
-    public function defaultSet()
+    public function defaultSet(): Page
     {
         $v = $this->c->Validator->reset()
             ->addRules([
@@ -163,7 +164,7 @@ class Groups extends Admin
      *
      * @return Page
      */
-    public function edit(array $args, $method)
+    public function edit(array $args, string $method): Page
     {
         // начало создания новой группы
         if (empty($args['id']) && empty($args['base'])) {
@@ -295,7 +296,7 @@ class Groups extends Admin
      *
      * @return Page
      */
-    public function save(Group $group, Group $baseGroup, array $data)
+    public function save(Group $group, Group $baseGroup, array $data): Page
     {
         if (! $group->groupAdmin && isset($data['g_moderator']) && 0 === $data['g_moderator']) {
             $data['g_mod_edit_users']       = 0;
@@ -341,7 +342,7 @@ class Groups extends Admin
      *
      * @return array
      */
-    protected function formEdit(array $args, Group $group, $marker)
+    protected function formEdit(array $args, Group $group, string $marker): array
     {
         $form = [
             'action' => $this->c->Router->link($marker, $args),
@@ -629,7 +630,7 @@ class Groups extends Admin
      *
      * @return Page
      */
-    public function delete(array $args, $method)
+    public function delete(array $args, string $method): Page
     {
         $group = $this->c->groups->get((int) $args['id']);
 
@@ -698,7 +699,7 @@ class Groups extends Admin
      *
      * @return array
      */
-    protected function formDelete(array $args, Group $group, $count, array $groups)
+    protected function formDelete(array $args, Group $group, int $count, array $groups): array
     {
         $form = [
             'action' => $this->c->Router->link('AdminGroupsDelete', $args),

+ 2 - 1
app/Models/Pages/Admin/Host.php

@@ -2,6 +2,7 @@
 
 namespace ForkBB\Models\Pages\Admin;
 
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Admin;
 
 class Host extends Admin
@@ -14,7 +15,7 @@ class Host extends Admin
      *
      * @return Page
      */
-    public function view(array $args, $method)
+    public function view(array $args, string $method): Page
     {
         $this->c->Lang->load('admin_host');
 

+ 2 - 1
app/Models/Pages/Admin/Index.php

@@ -2,6 +2,7 @@
 
 namespace ForkBB\Models\Pages\Admin;
 
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Admin;
 
 class Index extends Admin
@@ -11,7 +12,7 @@ class Index extends Admin
      *
      * @return Page
      */
-    public function index()
+    public function index(): Page
     {
         $this->c->Lang->load('admin_index');
 

+ 5 - 4
app/Models/Pages/Admin/Maintenance.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Pages\Admin;
 
 use ForkBB\Core\Validator;
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Admin;
 use ForkBB\Models\Config\Model as Config;
 
@@ -16,7 +17,7 @@ class Maintenance extends Admin
      *
      * @return Page
      */
-    public function view(array $args, $method)
+    public function view(array $args, string $method): Page
     {
         $this->c->Lang->load('admin_maintenance');
 
@@ -61,7 +62,7 @@ class Maintenance extends Admin
      *
      * @return array
      */
-    protected function formMaintenance(Config $config)
+    protected function formMaintenance(Config $config): array
     {
         return [
             'action' => $this->c->Router->link('AdminMaintenance'),
@@ -103,7 +104,7 @@ class Maintenance extends Admin
      *
      * @return array
      */
-    protected function formRebuild()
+    protected function formRebuild(): array
     {
         return [
             'action' => $this->c->Router->link('AdminMaintenanceRebuild'),
@@ -193,7 +194,7 @@ class Maintenance extends Admin
      *
      * @return Page
      */
-    public function rebuild(array $args, $method)
+    public function rebuild(array $args, string $method): Page
     {
         $this->c->Lang->load('admin_maintenance');
 

+ 3 - 2
app/Models/Pages/Admin/Options.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Pages\Admin;
 
 use ForkBB\Core\Validator;
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Admin;
 use ForkBB\Models\Config\Model as Config;
 
@@ -16,7 +17,7 @@ class Options extends Admin
      *
      * @return Page
      */
-    public function edit(array $args, $method)
+    public function edit(array $args, string $method): Page
     {
         $this->c->Lang->load('admin_options');
         $this->c->Lang->load('profile_other');
@@ -179,7 +180,7 @@ class Options extends Admin
      *
      * @return array
      */
-    protected function formEdit(Config $config)
+    protected function formEdit(Config $config): array
     {
         $form = [
             'action' => $this->c->Router->link('AdminOptions'),

+ 3 - 2
app/Models/Pages/Admin/Permissions.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Pages\Admin;
 
 use ForkBB\Core\Validator;
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Admin;
 use ForkBB\Models\Config\Model as Config;
 
@@ -16,7 +17,7 @@ class Permissions extends Admin
      *
      * @return Page
      */
-    public function edit(array $args, $method)
+    public function edit(array $args, string $method): Page
     {
         $this->c->Lang->load('admin_permissions');
 
@@ -76,7 +77,7 @@ class Permissions extends Admin
      *
      * @return array
      */
-    protected function formEdit(Config $config)
+    protected function formEdit(Config $config): array
     {
         $form = [
             'action' => $this->c->Router->link('AdminPermissions'),

+ 3 - 2
app/Models/Pages/Admin/Statistics.php

@@ -2,6 +2,7 @@
 
 namespace ForkBB\Models\Pages\Admin;
 
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Admin;
 
 class Statistics extends Admin
@@ -11,7 +12,7 @@ class Statistics extends Admin
      *
      * @return Page
      */
-    public function info()
+    public function info(): Page
     {
         // Is phpinfo() a disabled function?
         if (\strpos(\strtolower((string) \ini_get('disable_functions')), 'phpinfo') !== false) {
@@ -59,7 +60,7 @@ class Statistics extends Admin
      *
      * @return Page
      */
-    public function statistics()
+    public function statistics(): Page
     {
         $this->c->Lang->load('admin_index');
 

+ 3 - 4
app/Models/Pages/Admin/Users.php

@@ -5,7 +5,6 @@ namespace ForkBB\Models\Pages\Admin;
 use ForkBB\Core\Container;
 use ForkBB\Models\Pages\Admin;
 use ForkBB\Models\User\Model as User;
-use ForkBB\Models\Rules;
 
 abstract class Users extends Admin
 {
@@ -34,7 +33,7 @@ abstract class Users extends Admin
      *
      * @return string
      */
-    protected function encodeData($data)
+    protected function encodeData($data): string
     {
         if (\is_array($data)) {
             unset($data['token']);
@@ -53,7 +52,7 @@ abstract class Users extends Admin
      *
      * @return mixed
      */
-    protected function decodeData($data)
+    protected function decodeData(string $data)
     {
         $data = \explode(':', $data);
 
@@ -84,7 +83,7 @@ abstract class Users extends Admin
      *
      * @return false|array
      */
-    protected function checkSelected(array $selected, $action, $profile = false)
+    protected function checkSelected(array $selected, string $action, bool $profile = false)
     {
         $selected = \array_map(function ($value) { // ????
             return (int) $value;

+ 8 - 7
app/Models/Pages/Admin/Users/Action.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Pages\Admin\Users;
 
 use ForkBB\Core\Validator;
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Admin\Users;
 use RuntimeException;
 
@@ -15,7 +16,7 @@ class Action extends Users
      *
      * @return array
      */
-    protected function nameList(array $users)
+    protected function nameList(array $users): array
     {
         $result = [];
         foreach ($users as $user) {
@@ -35,7 +36,7 @@ class Action extends Users
      *
      * @return Page
      */
-    public function view(array $args, $method)
+    public function view(array $args, string $method): Page
     {
         if (isset($args['token'])) {
             if (! $this->c->Csrf->verify($args['token'], 'AdminUsersAction', $args)) {
@@ -105,7 +106,7 @@ class Action extends Users
      *
      * @return Page
      */
-    protected function delete(array $args, $method)
+    protected function delete(array $args, string $method): Page
     {
         if ('POST' === $method) {
             $v = $this->c->Validator->reset()
@@ -152,7 +153,7 @@ class Action extends Users
      *
      * @return array
      */
-    protected function formDelete(array $args)
+    protected function formDelete(array $args): array
     {
         $yn    = [1 => \ForkBB\__('Yes'), 0 => \ForkBB\__('No')];
         $names = \implode(', ', $this->nameList($this->userList));
@@ -213,7 +214,7 @@ class Action extends Users
      *
      * @return array
      */
-    protected function groupListForChange($profile)
+    protected function groupListForChange(bool $profile): array
     {
         $list = [];
         foreach ($this->c->groups->getList() as $id => $group) {
@@ -237,7 +238,7 @@ class Action extends Users
      *
      * @return Page
      */
-    protected function change(array $args, $method, $profile)
+    protected function change(array $args, string $method, bool $profile): Page
     {
         $rulePass = 'absent';
 
@@ -330,7 +331,7 @@ class Action extends Users
      *
      * @return array
      */
-    protected function formChange(array $args, $profile, $linkCancel, $checkPass)
+    protected function formChange(array $args, bool $profile, string $linkCancel, bool $checkPass): array
     {
         $yn    = [1 => \ForkBB\__('Yes'), 0 => \ForkBB\__('No')];
         $names = \implode(', ', $this->nameList($this->userList));

+ 2 - 1
app/Models/Pages/Admin/Users/Promote.php

@@ -2,6 +2,7 @@
 
 namespace ForkBB\Models\Pages\Admin\Users;
 
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Admin\Users;
 
 class Promote extends Users
@@ -14,7 +15,7 @@ class Promote extends Users
      *
      * @return Page
      */
-    public function promote(array $args, $method)
+    public function promote(array $args, string $method): Page
     {
         if (! $this->c->Csrf->verify($args['token'], 'AdminUserPromote', $args)) {
             return $this->c->Message->message('Bad token');

+ 5 - 4
app/Models/Pages/Admin/Users/Result.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Pages\Admin\Users;
 
 use ForkBB\Core\Validator;
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Admin\Users;
 use ForkBB\Models\User\Model as User;
 
@@ -16,7 +17,7 @@ class Result extends Users
      *
      * @return Page
      */
-    public function view(array $args, $method)
+    public function view(array $args, string $method): Page
     {
         $data = $this->decodeData($args['data']);
         if (false === $data) {
@@ -136,7 +137,7 @@ class Result extends Users
      *
      * @return array
      */
-    protected function forIP($ip)
+    protected function forIP(string $ip): array
     {
         $fromPosts = $this->c->posts->userInfoFromIP($ip);
         $ids       = $this->c->users->filter([
@@ -161,7 +162,7 @@ class Result extends Users
      *
      * @return array
      */
-    protected function forFilter(array $data)
+    protected function forFilter(array $data): array
     {
         $order = [
             $data['order_by'] => $data['direction'],
@@ -208,7 +209,7 @@ class Result extends Users
      *
      * @return array
      */
-    protected function form(array $users, $number, array $args)
+    protected function form(array $users, int $number, array $args): array
     {
         $form = [
             'action' => $this->c->Router->link('AdminUsersResult', $args),

+ 3 - 2
app/Models/Pages/Admin/Users/Stat.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Pages\Admin\Users;
 
 use ForkBB\Core\Validator;
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Admin\Users;
 
 class Stat extends Users
@@ -15,7 +16,7 @@ class Stat extends Users
      *
      * @return Page
      */
-    public function view(array $args, $method)
+    public function view(array $args, string $method): Page
     {
         $stat   = $this->c->posts->userStat((int) $args['id']);
         $number = \count($stat);
@@ -53,7 +54,7 @@ class Stat extends Users
      *
      * @return array
      */
-    protected function form(array $stat, $number)
+    protected function form(array $stat, int $number): array
     {
         $form = [
             'action' => null,

+ 5 - 4
app/Models/Pages/Admin/Users/View.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Pages\Admin\Users;
 
 use ForkBB\Core\Validator;
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Admin\Users;
 
 class View extends Users
@@ -14,7 +15,7 @@ class View extends Users
      *
      * @return array
      */
-    protected function groups($onlyKeys = false)
+    protected function groups(bool $onlyKeys = false): array
     {
         $groups = [
             -1 => \ForkBB\__('All groups'),
@@ -39,7 +40,7 @@ class View extends Users
      *
      * @return Page
      */
-    public function view(array $args, $method, array $data = [])
+    public function view(array $args, string $method, array $data = []): Page
     {
         if ('POST' === $method) {
             $v = $this->c->Validator->reset()
@@ -133,7 +134,7 @@ class View extends Users
      *
      * @return array
      */
-    protected function form(array $data)
+    protected function form(array $data): array
     {
         $form = [
             'action' => $this->c->Router->link('AdminUsers'),
@@ -359,7 +360,7 @@ class View extends Users
      *
      * @return array
      */
-    protected function formIP(array $data)
+    protected function formIP(array $data): array
     {
         $form = [
             'action' => $this->c->Router->link('AdminUsers'),

+ 7 - 7
app/Models/Pages/Auth.php

@@ -16,7 +16,7 @@ class Auth extends Page
      *
      * @return Page
      */
-    public function logout($args)
+    public function logout(array $args): Page
     {
         if (! $this->c->Csrf->verify($args['token'], 'Logout', $args)) {
             return $this->c->Redirect->page('Index')->message('Bad token');
@@ -38,7 +38,7 @@ class Auth extends Page
      *
      * @return Page
      */
-    public function login(array $args, $method)
+    public function login(array $args, string $method): Page
     {
         $this->c->Lang->load('auth');
 
@@ -91,7 +91,7 @@ class Auth extends Page
      *
      * @return array
      */
-    protected function formLogin($username, $save, $redirect)
+    protected function formLogin(string $username, $save, string $redirect): array
     {
         return [
             'action' => $this->c->Router->link('Login'),
@@ -188,7 +188,7 @@ class Auth extends Page
      *
      * @return Page
      */
-    public function forget(array $args, $method)
+    public function forget(array $args, string $method): Page
     {
         $this->c->Lang->load('auth');
 
@@ -267,7 +267,7 @@ class Auth extends Page
      *
      * @return array
      */
-    protected function formForget($email)
+    protected function formForget(string $email): array
     {
         return [
             'action' => $this->c->Router->link('Forget'),
@@ -308,7 +308,7 @@ class Auth extends Page
      *
      * @return Page
      */
-    public function changePass(array $args, $method)
+    public function changePass(array $args, string $method): Page
     {
         if (! \hash_equals($args['hash'], $this->c->Secury->hash($args['id'] . $args['key']))
             || ! ($user = $this->c->users->load((int) $args['id'])) instanceof User
@@ -378,7 +378,7 @@ class Auth extends Page
      *
      * @return array
      */
-    protected function formChange(array $args)
+    protected function formChange(array $args): array
     {
         return [
             'action' => $this->c->Router->link('ChangePassword', $args),

+ 2 - 2
app/Models/Pages/Ban.php

@@ -14,7 +14,7 @@ class Ban extends Page
      *
      * @return Page
      */
-    public function ban(User $user)
+    public function ban(User $user): Page
     {
         $this->httpStatus = 403;
         $this->nameTpl    = 'ban';
@@ -31,7 +31,7 @@ class Ban extends Page
     /**
      * Подготовка страницы к отображению
      */
-    public function prepare()
+    public function prepare(): void
     {
     }
 }

+ 3 - 3
app/Models/Pages/Debug.php

@@ -11,7 +11,7 @@ class Debug extends Page
      *
      * @return Page
      */
-    public function debug()
+    public function debug(): Page
     {
         if ($this->c->isInit('DB')) {
             $this->numQueries = $this->c->DB->getCount();
@@ -41,7 +41,7 @@ class Debug extends Page
     /**
      * Подготовка страницы к отображению
      */
-    public function prepare()
+    public function prepare(): void
     {
     }
 
@@ -51,7 +51,7 @@ class Debug extends Page
      *
      * @return array
      */
-    protected function getHttpHeaders()
+    protected function getHttpHeaders(): array
     {
         return [];
     }

+ 2 - 2
app/Models/Pages/Delete.php

@@ -15,7 +15,7 @@ class Delete extends Page
      *
      * @return Page
      */
-    public function delete(array $args, $method)
+    public function delete(array $args, string $method): Page
     {
         $post = $this->c->posts->load((int) $args['id']);
 
@@ -76,7 +76,7 @@ class Delete extends Page
      *
      * @return array
      */
-    protected function formDelete(array $args, Post $post, $deleteTopic)
+    protected function formDelete(array $args, Post $post, bool $deleteTopic): array
     {
         return [
             'action' => $this->c->Router->link('DeletePost', ['id' => $post->id]),

+ 3 - 3
app/Models/Pages/Edit.php

@@ -3,8 +3,8 @@
 namespace ForkBB\Models\Pages;
 
 use ForkBB\Core\Validator;
-use ForkBB\Models\Post\Model as Post;
 use ForkBB\Models\Page;
+use ForkBB\Models\Post\Model as Post;
 
 class Edit extends Page
 {
@@ -19,7 +19,7 @@ class Edit extends Page
      *
      * @return Page
      */
-    public function edit(array $args, $method)
+    public function edit(array $args, string $method): Page
     {
         $post = $this->c->posts->load((int) $args['id']);
 
@@ -75,7 +75,7 @@ class Edit extends Page
      *
      * @return Page
      */
-    protected function endEdit(Post $post, Validator $v)
+    protected function endEdit(Post $post, Validator $v): Page
     {
         $now         = \time();
         $executive   = $this->user->isAdmin || $this->user->isModerator($post);

+ 1 - 1
app/Models/Pages/Forum.php

@@ -13,7 +13,7 @@ class Forum extends Page
      *
      * @return Page
      */
-    public function view(array $args)
+    public function view(array $args): Page
     {
         $this->c->Lang->load('forum');
         $this->c->Lang->load('subforums');

+ 1 - 1
app/Models/Pages/Index.php

@@ -11,7 +11,7 @@ class Index extends Page
      *
      * @return Page
      */
-    public function view()
+    public function view(): Page
     {
         $this->c->Lang->load('index');
         $this->c->Lang->load('subforums');

+ 3 - 3
app/Models/Pages/Install.php

@@ -30,7 +30,7 @@ class Install extends Page
      *
      * @return array
      */
-    protected function DBTypes()
+    protected function DBTypes(): array
     {
         $dbTypes = [];
         $pdoDrivers = PDO::getAvailableDrivers();
@@ -63,7 +63,7 @@ class Install extends Page
      *
      * @return Page
      */
-    public function install(array $args, $method)
+    public function install(array $args, string $method): Page
     {
         $changeLang = false;
         if ('POST' === $method) {
@@ -489,7 +489,7 @@ class Install extends Page
      *
      * @return Page
      */
-    protected function installEnd(Validator $v)
+    protected function installEnd(Validator $v): Page
     {
         @\set_time_limit(0);
         $this->c->Cache->clear();

+ 1 - 1
app/Models/Pages/Maintenance.php

@@ -32,7 +32,7 @@ class Maintenance extends Page
     /**
      * Подготовка страницы к отображению
      */
-    public function prepare()
+    public function prepare(): void
     {
     }
 }

+ 2 - 1
app/Models/Pages/Message.php

@@ -12,10 +12,11 @@ class Message extends Page
      * @param string $message
      * @param bool $back
      * @param int $status
+     * @param array $headers
      *
      * @return Page
      */
-    public function message($message, $back = true, $status = 404, array $headers = [])
+    public function message(string $message, bool $back = true, int $status = 404, array $headers = []): Page
     {
         $this->nameTpl     = 'message';
         $this->httpStatus  = \max(200, $status);

+ 1 - 1
app/Models/Pages/Misc.php

@@ -13,7 +13,7 @@ class Misc extends Page
      *
      * @return Page
      */
-    public function markread(array $args)
+    public function markread(array $args): Page
     {
         $forum = $this->c->forums->loadTree($args['id']);
         if (null === $forum) {

+ 4 - 5
app/Models/Pages/Post.php

@@ -4,9 +4,8 @@ namespace ForkBB\Models\Pages;
 
 use ForkBB\Core\Validator;
 use ForkBB\Models\Model;
-use ForkBB\Models\Forum;
-use ForkBB\Models\Topic\Model as Topic;
 use ForkBB\Models\Page;
+use ForkBB\Models\Topic\Model as Topic;
 
 class Post extends Page
 {
@@ -21,7 +20,7 @@ class Post extends Page
      *
      * @return Page
      */
-    public function newTopic(array $args, $method)
+    public function newTopic(array $args, string $method): Post
     {
         $forum = $this->c->forums->get((int) $args['id']);
 
@@ -65,7 +64,7 @@ class Post extends Page
      *
      * @return Page
      */
-    public function newReply(array $args, $method)
+    public function newReply(array $args, string $method): Post
     {
         $topic = $this->c->topics->load((int) $args['id']);
 
@@ -122,7 +121,7 @@ class Post extends Page
      *
      * @return Page
      */
-    protected function endPost(Model $model, Validator $v)
+    protected function endPost(Model $model, Validator $v): Post
     {
         $now       = \time();
         $username  = $this->user->isGuest ? $v->username : $this->user->username;

+ 1 - 1
app/Models/Pages/PostFormTrait.php

@@ -18,7 +18,7 @@ trait PostFormTrait
      *
      * @return array
      */
-    protected function messageForm(array $args, Model $model, $marker, $editPost = false, $editSubject = false, $quickReply = false)
+    protected function messageForm(array $args, Model $model, string $marker, bool $editPost = false, bool $editSubject = false, bool $quickReply = false): array
     {
         $vars = isset($args['_vars']) ? $args['_vars'] : null;
         unset($args['_vars']);

+ 1 - 1
app/Models/Pages/PostValidatorTrait.php

@@ -97,7 +97,7 @@ trait PostValidatorTrait
      *
      * @return Validator
      */
-    protected function messageValidator(Model $model, $marker, array $args, $editPost = false, $editSubject = false)
+    protected function messageValidator(Model $model, string $marker, array $args, bool $editPost = false, bool $editSubject = false): Validator
     {
         if ($this->user->isGuest) {
             $ruleEmail    = ('1' == $this->c->config->p_force_guest_email ? 'required|' : '') . 'string:trim|email:noban';

+ 4 - 4
app/Models/Pages/Profile.php

@@ -15,7 +15,7 @@ abstract class Profile extends Page
      *
      * @return bool
      */
-    protected function initProfile($id)
+    protected function initProfile($id): bool
     {
         $this->curUser = $this->c->users->load((int) $id);
 
@@ -63,7 +63,7 @@ abstract class Profile extends Page
      *
      * @return array
      */
-    protected function crumbs(...$crumbs)
+    protected function crumbs(...$crumbs): array
     {
         $crumbs[] = [$this->curUser->link, \ForkBB\__('User %s', $this->curUser->username)];
         $crumbs[] = [$this->c->Router->link('Userlist'), \ForkBB\__('User list')];
@@ -78,7 +78,7 @@ abstract class Profile extends Page
      *
      * @return array
      */
-    protected function btns($type)
+    protected function btns(string $type): array
     {
         $btns = [];
         if ($this->user->isAdmin && ! $this->rules->editProfile) {
@@ -143,7 +143,7 @@ abstract class Profile extends Page
      *
      * @return string
      */
-    protected function linkChangeGroup()
+    protected function linkChangeGroup(): string
     {
         return $this->c->Router->link('AdminUsersAction',  [
             'action' => 'change_group',

+ 3 - 2
app/Models/Pages/Profile/Config.php

@@ -3,6 +3,7 @@
 namespace ForkBB\Models\Pages\Profile;
 
 use ForkBB\Core\Validator;
+use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Profile;
 
 class Config extends Profile
@@ -15,7 +16,7 @@ class Config extends Profile
      *
      * @return Page
      */
-    public function config(array $args, $method)
+    public function config(array $args, string $method): Page
     {
         if (false === $this->initProfile($args['id']) || ! $this->rules->editConfig) {
             return $this->c->Message->message('Bad request');
@@ -100,7 +101,7 @@ class Config extends Profile
      *
      * @return array
      */
-    protected function form()
+    protected function form(): array
     {
         $form = [
             'action' => $this->c->Router->link('EditUserBoardConfig', ['id' => $this->curUser->id]),

Some files were not shown because too many files changed in this diff