Skip to content

Commit 7c91d42

Browse files
authored
Merge pull request #927 from PHPSocialNetwork/fix/php84-deprecation-warnings
Fix PHP 8.4 deprecation warnings for implicitly nullable parameters
2 parents 588e8ff + 1ef9ac7 commit 7c91d42

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

lib/Phpfastcache/CacheContract.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(CacheItemPoolInterface $cacheInstance)
3232
/**
3333
* @throws InvalidArgumentException
3434
*/
35-
public function get(string|\Stringable $cacheKey, callable $callback, DateInterval|int $expiresAfter = null): mixed
35+
public function get(string|\Stringable $cacheKey, callable $callback, DateInterval|int|null $expiresAfter = null): mixed
3636
{
3737
$cacheItem = $this->cacheInstance->getItem((string) $cacheKey);
3838

@@ -54,7 +54,7 @@ public function get(string|\Stringable $cacheKey, callable $callback, DateInterv
5454
/**
5555
* @throws InvalidArgumentException
5656
*/
57-
public function __invoke(string $cacheKey, callable $callback, DateInterval|int $expiresAfter = null): mixed
57+
public function __invoke(string $cacheKey, callable $callback, DateInterval|int|null $expiresAfter = null): mixed
5858
{
5959
return $this->get($cacheKey, $callback, $expiresAfter);
6060
}

lib/Phpfastcache/Cluster/AggregatorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function getCluster(int $strategy): ClusterPoolInterface;
8686
*
8787
* @return void
8888
*/
89-
public function aggregateDriverByName(string $driverName, ConfigurationOption $driverConfig = null): void;
89+
public function aggregateDriverByName(string $driverName, ?ConfigurationOption $driverConfig = null): void;
9090

9191
/**
9292
* @param AggregatablePoolInterface $driverPool

lib/Phpfastcache/Cluster/ClusterAggregator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function aggregateDriver(AggregatablePoolInterface $driverPool): void
9494
* @throws PhpfastcacheDriverNotFoundException
9595
* @throws PhpfastcacheLogicException
9696
*/
97-
public function aggregateDriverByName(string $driverName, ConfigurationOption $driverConfig = null): void
97+
public function aggregateDriverByName(string $driverName, ?ConfigurationOption $driverConfig = null): void
9898
{
9999
if (isset($this->cluster)) {
100100
throw new PhpfastcacheLogicException('The cluster has been already build, cannot aggregate more pools.');

lib/Phpfastcache/Drivers/Redis/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function getDatabase(): ?int
9898
* @return static
9999
* @throws PhpfastcacheLogicException
100100
*/
101-
public function setDatabase(int $database = null): static
101+
public function setDatabase(?int $database = null): static
102102
{
103103
return $this->setProperty('database', $database);
104104
}

lib/Phpfastcache/Exceptions/PhpfastcacheIOException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class PhpfastcacheIOException extends PhpfastcacheCoreException
2424
/**
2525
* @inheritdoc
2626
*/
27-
public function __construct(string $message = "", int $code = 0, \Throwable $previous = null)
27+
public function __construct(string $message = "", int $code = 0, ?\Throwable $previous = null)
2828
{
2929
$lastError = error_get_last();
3030
if ($lastError) {

lib/Phpfastcache/Helper/Psr16Adapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Psr16Adapter implements CacheInterface
4949
* @throws PhpfastcacheDriverException
5050
* @throws PhpfastcacheDriverNotFoundException
5151
*/
52-
public function __construct(string|ExtendedCacheItemPoolInterface $driver, ConfigurationOptionInterface $config = null)
52+
public function __construct(string|ExtendedCacheItemPoolInterface $driver, ?ConfigurationOptionInterface $config = null)
5353
{
5454
if ($driver instanceof ExtendedCacheItemPoolInterface) {
5555
if ($config !== null) {

0 commit comments

Comments
 (0)