Up min PHP version from 7.3 to 8.0 - 5

This commit is contained in:
Visman 2023-04-28 19:34:31 +07:00
parent e2cf3896b6
commit 14c3a5d0db
11 changed files with 17 additions and 36 deletions

View file

@ -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];
}

View file

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

View file

@ -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

View file

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

View file

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

View file

@ -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 = [];

View file

@ -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'),

View file

@ -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

View file

@ -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;
/**
* Поиск тем/сообщений в соответствии с поисковым запросом

View file

@ -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;

View file

@ -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;