From cbb3cfcce56f0f6892bdd59e1918fb14044bbe14 Mon Sep 17 00:00:00 2001 From: William Date: Mon, 12 Jan 2026 17:18:02 +0200 Subject: [PATCH] Fix: PHP 8.1+ implicit nullable parameter deprecations --- src/Console/QtCommand.php | 4 ++-- src/Debugger/Debugger.php | 2 +- src/Libraries/Archive/Adapters/PharAdapter.php | 2 +- src/Libraries/Archive/Adapters/ZipAdapter.php | 2 +- .../Database/Adapters/Idiorm/IdiormPatch.php | 6 +++--- .../Adapters/Sleekdb/Statements/Criteria.php | 2 +- src/Libraries/Database/Schemas/Column.php | 12 ++++++------ src/Libraries/Database/Schemas/Table.php | 2 +- src/Libraries/Database/Traits/TableTrait.php | 2 +- src/Libraries/HttpClient/HttpClient.php | 8 ++++---- src/Libraries/Jwt/JwtToken.php | 4 ++-- src/Paginator/Contracts/PaginatorInterface.php | 2 +- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Console/QtCommand.php b/src/Console/QtCommand.php index 754fd75c3..022cc7c24 100644 --- a/src/Console/QtCommand.php +++ b/src/Console/QtCommand.php @@ -87,7 +87,7 @@ public function __construct() * @param string|null $key * @return mixed|string */ - public function getArgument(string $key = null) + public function getArgument(?string $key = null) { return $this->input->getArgument($key) ?? ''; } @@ -97,7 +97,7 @@ public function getArgument(string $key = null) * @param string|null $key * @return mixed|string */ - public function getOption(string $key = null) + public function getOption(?string $key = null) { return $this->input->getOption($key) ?? ''; } diff --git a/src/Debugger/Debugger.php b/src/Debugger/Debugger.php index 10ba8f68e..71a116714 100644 --- a/src/Debugger/Debugger.php +++ b/src/Debugger/Debugger.php @@ -108,7 +108,7 @@ public function __construct(DebuggerStore $store, DebugBar $debugBar, array $col * @return Debugger * @throws DebugBarException */ - public static function getInstance(DebuggerStore $store = null, DebugBar $debugBar = null, ?array $collectors = []): Debugger + public static function getInstance(?DebuggerStore $store = null, ?DebugBar $debugBar = null, ?array $collectors = []): Debugger { if (self::$instance === null) { $debugBar ??= new DebugBar(); diff --git a/src/Libraries/Archive/Adapters/PharAdapter.php b/src/Libraries/Archive/Adapters/PharAdapter.php index 3a80fbed9..362aa867a 100644 --- a/src/Libraries/Archive/Adapters/PharAdapter.php +++ b/src/Libraries/Archive/Adapters/PharAdapter.php @@ -108,7 +108,7 @@ public function addEmptyDir(string $directory): bool * @inheritDoc * @throws BaseException */ - public function addFile(string $filePath, string $entryName = null): bool + public function addFile(string $filePath, ?string $entryName = null): bool { $this->ensureArchiveOpen(); diff --git a/src/Libraries/Archive/Adapters/ZipAdapter.php b/src/Libraries/Archive/Adapters/ZipAdapter.php index 2e8964266..19b0a80d9 100644 --- a/src/Libraries/Archive/Adapters/ZipAdapter.php +++ b/src/Libraries/Archive/Adapters/ZipAdapter.php @@ -98,7 +98,7 @@ public function addEmptyDir(string $directory): bool * @inheritDoc * @throws BaseException */ - public function addFile(string $filePath, string $entryName = null): bool + public function addFile(string $filePath, ?string $entryName = null): bool { $this->ensureArchiveOpen(); diff --git a/src/Libraries/Database/Adapters/Idiorm/IdiormPatch.php b/src/Libraries/Database/Adapters/Idiorm/IdiormPatch.php index 567c962f7..c621cf65f 100644 --- a/src/Libraries/Database/Adapters/Idiorm/IdiormPatch.php +++ b/src/Libraries/Database/Adapters/Idiorm/IdiormPatch.php @@ -63,7 +63,7 @@ public function use(object $ormModel): IdiormPatch * @param string|null $table_alias * @return object */ - public function leftJoin(string $table, array $constraint, string $table_alias = null): object + public function leftJoin(string $table, array $constraint, ?string $table_alias = null): object { return $this->addJoin('LEFT', $table, $constraint, $table_alias); } @@ -75,7 +75,7 @@ public function leftJoin(string $table, array $constraint, string $table_alias = * @param string|null $table_alias * @return object */ - public function rightJoin(string $table, array $constraint, string $table_alias = null): object + public function rightJoin(string $table, array $constraint, ?string $table_alias = null): object { return $this->addJoin('RIGHT', $table, $constraint, $table_alias); } @@ -88,7 +88,7 @@ public function rightJoin(string $table, array $constraint, string $table_alias * @param string|null $table_alias * @return object */ - public function addJoin(string $operator, string $table, array $constraint, string $table_alias = null): object + public function addJoin(string $operator, string $table, array $constraint, ?string $table_alias = null): object { return $this->ormModel->_add_join_source($operator, $table, $constraint, $table_alias); } diff --git a/src/Libraries/Database/Adapters/Sleekdb/Statements/Criteria.php b/src/Libraries/Database/Adapters/Sleekdb/Statements/Criteria.php index 3f03b3a39..865861213 100644 --- a/src/Libraries/Database/Adapters/Sleekdb/Statements/Criteria.php +++ b/src/Libraries/Database/Adapters/Sleekdb/Statements/Criteria.php @@ -59,7 +59,7 @@ public function criterias(...$criterias): DbalInterface * @inheritDoc * @throws DatabaseException */ - public function having(string $column, string $operator, string $value = null): DbalInterface + public function having(string $column, string $operator, ?string $value = null): DbalInterface { if (!in_array($operator, $this->operators)) { throw DatabaseException::operatorNotSupported($operator); diff --git a/src/Libraries/Database/Schemas/Column.php b/src/Libraries/Database/Schemas/Column.php index 315dd1bab..cd4e54d38 100644 --- a/src/Libraries/Database/Schemas/Column.php +++ b/src/Libraries/Database/Schemas/Column.php @@ -193,7 +193,7 @@ class Column * @param string|null $type * @param mixed $constraint */ - public function __construct(string $name, string $type = null, $constraint = null) + public function __construct(string $name, ?string $type = null, $constraint = null) { $this->name = $name; @@ -226,7 +226,7 @@ public function indexDrop(string $indexName): Column * @param string|null $action * @return mixed */ - public function get(string $property, string $action = null) + public function get(string $property, ?string $action = null) { return (isset($this->$property) && $action != self::RENAME && $action != self::DROP) ? $this->$property : null; } @@ -252,7 +252,7 @@ public function primary() * Adds an index key to the column * @param string|null $name */ - public function index(string $name = null) + public function index(?string $name = null) { $this->indexKey = Key::INDEX; @@ -265,7 +265,7 @@ public function index(string $name = null) * Adds unique key to the column * @param string|null $name */ - public function unique(string $name = null) + public function unique(?string $name = null) { $this->indexKey = Key::UNIQUE; @@ -278,7 +278,7 @@ public function unique(string $name = null) * Adds a fulltext key the column * @param string|null $name */ - public function fulltext(string $name = null) + public function fulltext(?string $name = null) { $this->indexKey = Key::FULLTEXT; @@ -291,7 +291,7 @@ public function fulltext(string $name = null) * Adds a spatial key the column * @param string|null $name */ - public function spatial(string $name = null) + public function spatial(?string $name = null) { $this->indexKey = Key::SPATIAL; diff --git a/src/Libraries/Database/Schemas/Table.php b/src/Libraries/Database/Schemas/Table.php index 316a944a1..478f7c994 100644 --- a/src/Libraries/Database/Schemas/Table.php +++ b/src/Libraries/Database/Schemas/Table.php @@ -209,7 +209,7 @@ public function dropColumn(string $name) * @param string $indexType * @param string|null $indexName */ - public function addIndex(string $columnName, string $indexType, string $indexName = null) + public function addIndex(string $columnName, string $indexType, ?string $indexName = null) { if ($this->action == self::ALTER) { $this->columns[] = [ diff --git a/src/Libraries/Database/Traits/TableTrait.php b/src/Libraries/Database/Traits/TableTrait.php index 332a6cfe6..259cdc461 100644 --- a/src/Libraries/Database/Traits/TableTrait.php +++ b/src/Libraries/Database/Traits/TableTrait.php @@ -124,7 +124,7 @@ protected function columnsSql(): string * @param string|null $action * @return string */ - protected function composeColumn(Column $column, string $action = null): string + protected function composeColumn(Column $column, ?string $action = null): string { return $this->columnAttrSql($column->get(Column::NAME), '`', '`') . diff --git a/src/Libraries/HttpClient/HttpClient.php b/src/Libraries/HttpClient/HttpClient.php index 7542816f4..92c39e236 100644 --- a/src/Libraries/HttpClient/HttpClient.php +++ b/src/Libraries/HttpClient/HttpClient.php @@ -206,7 +206,7 @@ public function start(): HttpClient * @return mixed|null * @throws BaseException */ - public function getRequestHeaders(string $header = null) + public function getRequestHeaders(?string $header = null) { $this->ensureSingleRequest(); @@ -223,7 +223,7 @@ public function getRequestHeaders(string $header = null) * @return mixed|null * @throws BaseException */ - public function getResponseHeaders(string $header = null) + public function getResponseHeaders(?string $header = null) { $this->ensureSingleRequest(); @@ -242,7 +242,7 @@ public function getResponseHeaders(string $header = null) * @return mixed|null * @throws BaseException */ - public function getResponseCookies(string $cookie = null) + public function getResponseCookies(?string $cookie = null) { $this->ensureSingleRequest(); @@ -291,7 +291,7 @@ public function getErrors(): array * @return mixed * @throws BaseException */ - public function info(int $option = null) + public function info(?int $option = null) { $this->ensureSingleRequest(); diff --git a/src/Libraries/Jwt/JwtToken.php b/src/Libraries/Jwt/JwtToken.php index 16dda62f7..9d0b27aed 100644 --- a/src/Libraries/Jwt/JwtToken.php +++ b/src/Libraries/Jwt/JwtToken.php @@ -54,7 +54,7 @@ class JwtToken extends JWT * @param string|null $key * @throws EnvException */ - public function __construct(string $key = null) + public function __construct(?string $key = null) { $this->key = $key ?? env('APP_KEY'); } @@ -124,7 +124,7 @@ public function setData(array $data): JwtToken * @return string * @throws JwtException */ - public function compose($keyId = null, array $head = null): string + public function compose($keyId = null, ?array $head = null): string { if (empty($this->payload)) { throw JwtException::payloadNotFound(); diff --git a/src/Paginator/Contracts/PaginatorInterface.php b/src/Paginator/Contracts/PaginatorInterface.php index 65727c04d..53119f317 100644 --- a/src/Paginator/Contracts/PaginatorInterface.php +++ b/src/Paginator/Contracts/PaginatorInterface.php @@ -122,5 +122,5 @@ public function links(bool $withBaseUrl = false): array; * @param int|null $pageItemsCount * @return string|null */ - public function getPagination(bool $withBaseUrl = false, int $pageItemsCount = null): ?string; + public function getPagination(bool $withBaseUrl = false, ?int $pageItemsCount = null): ?string; }