Fix PHP 8.4 deprecation

Implicitly marking parameter as nullable is deprecated, the explicit nullable type must be used instead
This commit is contained in:
Marcin Morawski 2025-07-30 17:37:48 +02:00
parent 4c0b97d605
commit 17d7ccd7dd
9 changed files with 11 additions and 11 deletions

View file

@ -443,7 +443,7 @@ class ItakuBridge extends BridgeAbstract
return $data['owner']; return $data['owner'];
} }
private function getPost($id, array $metadata = null) private function getPost($id, ?array $metadata = null)
{ {
if (isset($metadata) && count($metadata['gallery_images']) < $metadata['num_images']) { if (isset($metadata) && count($metadata['gallery_images']) < $metadata['num_images']) {
$metadata = null; //force re-fetch of metadata $metadata = null; //force re-fetch of metadata
@ -515,7 +515,7 @@ class ItakuBridge extends BridgeAbstract
]; ];
} }
private function getCommission($id, array $metadata = null) private function getCommission($id, ?array $metadata = null)
{ {
$url = self::URI . '/api/commissions/' . $id . '/?format=json'; $url = self::URI . '/api/commissions/' . $id . '/?format=json';
$uri = self::URI . '/commissions/' . $id; $uri = self::URI . '/commissions/' . $id;

View file

@ -23,7 +23,7 @@ class ArrayCache implements CacheInterface
return $default; return $default;
} }
public function set(string $key, $value, int $ttl = null): void public function set(string $key, $value, ?int $ttl = null): void
{ {
$this->data[$key] = [ $this->data[$key] = [
'key' => $key, 'key' => $key,

View file

@ -45,7 +45,7 @@ class FileCache implements CacheInterface
return $default; return $default;
} }
public function set($key, $value, int $ttl = null): void public function set($key, $value, ?int $ttl = null): void
{ {
$item = [ $item = [
'key' => $key, 'key' => $key,

View file

@ -9,7 +9,7 @@ class NullCache implements CacheInterface
return $default; return $default;
} }
public function set(string $key, $value, int $ttl = null): void public function set(string $key, $value, ?int $ttl = null): void
{ {
} }

View file

@ -77,7 +77,7 @@ class SQLiteCache implements CacheInterface
return $default; return $default;
} }
public function set(string $key, $value, int $ttl = null): void public function set(string $key, $value, ?int $ttl = null): void
{ {
$cacheKey = $this->createCacheKey($key); $cacheKey = $this->createCacheKey($key);
$blob = serialize($value); $blob = serialize($value);

View file

@ -12,7 +12,7 @@ class CacheFactory
$this->logger = $logger; $this->logger = $logger;
} }
public function create(string $name = null): CacheInterface public function create(?string $name = null): CacheInterface
{ {
$cacheNames = []; $cacheNames = [];
foreach (scandir(PATH_LIB_CACHES) as $file) { foreach (scandir(PATH_LIB_CACHES) as $file) {

View file

@ -4,7 +4,7 @@ interface CacheInterface
{ {
public function get(string $key, $default = null); public function get(string $key, $default = null);
public function set(string $key, $value, int $ttl = null): void; public function set(string $key, $value, ?int $ttl = null): void;
public function delete(string $key): void; public function delete(string $key): void;

View file

@ -227,7 +227,7 @@ final class Request
return $this->get[$key] ?? $default; return $this->get[$key] ?? $default;
} }
public function server(string $key, string $default = null): ?string public function server(string $key, ?string $default = null): ?string
{ {
return $this->server[$key] ?? $default; return $this->server[$key] ?? $default;
} }

View file

@ -712,7 +712,7 @@ class Parsedown
# #
# Setext # Setext
protected function blockSetextHeader($Line, array $Block = null) protected function blockSetextHeader($Line, ?array $Block = null)
{ {
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
{ {
@ -850,7 +850,7 @@ class Parsedown
# #
# Table # Table
protected function blockTable($Line, array $Block = null) protected function blockTable($Line, ?array $Block = null)
{ {
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
{ {