فهرست منبع

Up min PHP version from 7.3 to 8.0 - 5

Visman 2 سال پیش
والد
کامیت
14c3a5d0db

+ 1 - 7
app/Core/DB.php

@@ -264,13 +264,7 @@ class DB
             && \array_key_exists(':' . $key, $params)
         ) {
             return $params[':' . $key];
-        } elseif (
-            (
-                \is_string($key)
-                || \is_int($key)
-            )
-            && \array_key_exists($key, $params)
-        ) {
+        } elseif (\array_key_exists($key, $params)) {
             return $params[$key];
         }
 

+ 1 - 1
app/Core/Files.php

@@ -988,7 +988,7 @@ class Files
     /**
      * Получает файл(ы) из формы
      */
-    public function upload(array $file): mixed
+    public function upload(array $file): File|array|false|null
     {
         $this->error = null;
 

+ 3 - 7
app/Core/HTMLCleaner.php

@@ -15,21 +15,17 @@ use RuntimeException;
 
 class HTMLCleaner extends Jevix
 {
-    protected string $hConfigFile;
-
     protected ?string $hConfigName = null;
 
-    public function __construct(string $file)
+    public function __construct(protected string $hConfigFile)
     {
-        if (! \is_file($file)) {
+        if (! \is_file($hConfigFile)) {
             throw new RuntimeException('File not found');
         }
 
-        if (! \is_readable($file)) {
+        if (! \is_readable($hConfigFile)) {
             throw new RuntimeException('File can not be read');
         }
-
-        $this->hConfigFile = $file;
     }
 
     public function setConfig(string $name = 'default'): self

+ 0 - 7
app/Core/Image/GDDriver.php

@@ -139,11 +139,4 @@ class GDDriver extends DefaultDriver
 
         return $result;
     }
-
-    public function destroy(mixed $image): void
-    {
-        if (\is_resource($image)) {
-            \imagedestroy($image);
-        }
-    }
 }

+ 0 - 4
app/Core/Image/ImagickDriver.php

@@ -123,8 +123,4 @@ class ImagickDriver extends DefaultDriver
             throw new FileException($e->getMessage());
         }
     }
-
-    public function destroy(mixed $imagick): void
-    {
-    }
 }

+ 1 - 1
app/Models/Pages/Admin/Parser/BBCode.php

@@ -656,7 +656,7 @@ class BBCode extends Parser
     /**
      * Формирует данные для формы
      */
-    protected function formEditSub(mixed $data, string $name, string $class, string|array $legend, string|array $info): array
+    protected function formEditSub(?array $data, string $name, string $class, string|array $legend, string|array $info): array
     {
         $yn     = [1 => __('Yes'), 0 => __('No')];
         $fields = [];

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

@@ -101,9 +101,9 @@ class Auth extends Page
         $this->regLink      = 1 === $this->c->config->b_regs_allow ? $this->c->Router->link('Register') : null;
 
         $username           = $v->username ?? $username;
-        $save               = $v->save ?? 1;
+        $save               = $v->save ?? true;
         $redirect           = $v->redirect ?? $this->c->Router->validate($ref, 'Index');
-        $this->form         = $this->formLogin($username, $save, $redirect);
+        $this->form         = $this->formLogin($username, (bool) $save, $redirect);
 
         return $this;
     }
@@ -135,7 +135,7 @@ class Auth extends Page
     /**
      * Подготавливает массив данных для формы
      */
-    protected function formLogin(string $username, mixed $save, string $redirect): array
+    protected function formLogin(string $username, bool $save, string $redirect): array
     {
         return [
             'action' => $this->c->Router->link('Login'),

+ 2 - 1
app/Models/Post/View.php

@@ -11,6 +11,7 @@ declare(strict_types=1);
 namespace ForkBB\Models\Post;
 
 use ForkBB\Models\Action;
+use ForkBB\Models\Model;
 use ForkBB\Models\Post\Post;
 use ForkBB\Models\Search\Search;
 use ForkBB\Models\Topic\Topic;
@@ -23,7 +24,7 @@ class View extends Action
     /**
      * Возвращает список сообщений
      */
-    public function view(mixed $arg, bool $review = false): array
+    public function view(Model $arg, bool $review = false): array
     {
         if (
             ! $arg instanceof Topic

+ 3 - 3
app/Models/Search/Execute.php

@@ -11,11 +11,11 @@ declare(strict_types=1);
 namespace ForkBB\Models\Search;
 
 use ForkBB\Core\Validator;
+use ForkBB\Core\DB\DBStatement;
 use ForkBB\Models\Method;
 use ForkBB\Models\Forum\Forum;
 use ForkBB\Models\Post\Post;
 use PDO;
-use PDOStatement;
 use RuntimeException;
 
 class Execute extends Method
@@ -24,8 +24,8 @@ class Execute extends Method
     protected string $queryCJK;
     protected int $sortType;
     protected array $words;
-    protected ?PDOStatement $stmtIdx;
-    protected ?PDOStatement $stmtCJK;
+    protected ?DBStatement $stmtIdx;
+    protected ?DBStatement $stmtCJK;
 
     /**
      * Поиск тем/сообщений в соответствии с поисковым запросом

+ 2 - 1
app/Models/Topic/View.php

@@ -11,6 +11,7 @@ declare(strict_types=1);
 namespace ForkBB\Models\Topic;
 
 use ForkBB\Models\Action;
+use ForkBB\Models\Model;
 use ForkBB\Models\Forum\Forum;
 use ForkBB\Models\Search\Search;
 use ForkBB\Models\Topic\Topic;
@@ -23,7 +24,7 @@ class View extends Action
     /**
      * Возвращает список тем
      */
-    public function view(mixed $arg): array
+    public function view(Model $arg): array
     {
         if ($arg instanceof Forum) {
             $full = false;

+ 1 - 1
app/Models/Validators/Username.php

@@ -19,7 +19,7 @@ class Username extends RulesValidator
     /**
      * Проверяет имя пользователя
      */
-    public function username(Validator $v, string $username, mixed  $attrs, mixed $originalUser): string
+    public function username(Validator $v, string $username, mixed $attrs, mixed $originalUser): string
     {
         if ($originalUser instanceof User) {
             $id   = $originalUser->id;