From c8c7d4c4588d46590ba96602e840a7688ca4171f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 23 May 2020 15:02:18 +0200 Subject: [PATCH] [Cache] $lifetime cannot be null --- src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php | 2 +- .../Component/Cache/Adapter/FilesystemTagAwareAdapter.php | 2 +- src/Symfony/Component/Cache/Adapter/Psr16Adapter.php | 2 +- src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php | 2 +- src/Symfony/Component/Cache/Traits/AbstractTrait.php | 2 +- src/Symfony/Component/Cache/Traits/ApcuTrait.php | 2 +- src/Symfony/Component/Cache/Traits/DoctrineTrait.php | 2 +- src/Symfony/Component/Cache/Traits/FilesystemTrait.php | 2 +- src/Symfony/Component/Cache/Traits/MemcachedTrait.php | 2 +- src/Symfony/Component/Cache/Traits/PdoTrait.php | 2 +- src/Symfony/Component/Cache/Traits/PhpFilesTrait.php | 2 +- src/Symfony/Component/Cache/Traits/RedisTrait.php | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php index 5a9f94bb9a..1a73d974c9 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php @@ -128,7 +128,7 @@ abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagA * * @return array The identifiers that failed to be cached or a boolean stating if caching succeeded or not */ - abstract protected function doSave(array $values, ?int $lifetime, array $addTagData = [], array $removeTagData = []): array; + abstract protected function doSave(array $values, int $lifetime, array $addTagData = [], array $removeTagData = []): array; /** * Removes multiple items from the pool and their corresponding tags. diff --git a/src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php index 2ce9eeb977..f9ad16811c 100644 --- a/src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php @@ -93,7 +93,7 @@ class FilesystemTagAwareAdapter extends AbstractTagAwareAdapter implements Prune /** * {@inheritdoc} */ - protected function doSave(array $values, ?int $lifetime, array $addTagData = [], array $removeTagData = []): array + protected function doSave(array $values, int $lifetime, array $addTagData = [], array $removeTagData = []): array { $failed = $this->doSaveCache($values, $lifetime); diff --git a/src/Symfony/Component/Cache/Adapter/Psr16Adapter.php b/src/Symfony/Component/Cache/Adapter/Psr16Adapter.php index aa93dfef0f..4cbe35c43f 100644 --- a/src/Symfony/Component/Cache/Adapter/Psr16Adapter.php +++ b/src/Symfony/Component/Cache/Adapter/Psr16Adapter.php @@ -79,7 +79,7 @@ class Psr16Adapter extends AbstractAdapter implements PruneableInterface, Resett /** * {@inheritdoc} */ - protected function doSave(array $values, ?int $lifetime) + protected function doSave(array $values, int $lifetime) { return $this->pool->setMultiple($values, 0 === $lifetime ? null : $lifetime); } diff --git a/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php index 8bf9d37db7..6e7bb18212 100644 --- a/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php @@ -91,7 +91,7 @@ class RedisTagAwareAdapter extends AbstractTagAwareAdapter /** * {@inheritdoc} */ - protected function doSave(array $values, ?int $lifetime, array $addTagData = [], array $delTagData = []): array + protected function doSave(array $values, int $lifetime, array $addTagData = [], array $delTagData = []): array { $eviction = $this->getRedisEvictionPolicy(); if ('noeviction' !== $eviction && 0 !== strpos($eviction, 'volatile-')) { diff --git a/src/Symfony/Component/Cache/Traits/AbstractTrait.php b/src/Symfony/Component/Cache/Traits/AbstractTrait.php index 8006855c5b..fbcdc74def 100644 --- a/src/Symfony/Component/Cache/Traits/AbstractTrait.php +++ b/src/Symfony/Component/Cache/Traits/AbstractTrait.php @@ -78,7 +78,7 @@ trait AbstractTrait * * @return array|bool The identifiers that failed to be cached or a boolean stating if caching succeeded or not */ - abstract protected function doSave(array $values, ?int $lifetime); + abstract protected function doSave(array $values, int $lifetime); /** * {@inheritdoc} diff --git a/src/Symfony/Component/Cache/Traits/ApcuTrait.php b/src/Symfony/Component/Cache/Traits/ApcuTrait.php index 4e1acc1627..88c3360ccc 100644 --- a/src/Symfony/Component/Cache/Traits/ApcuTrait.php +++ b/src/Symfony/Component/Cache/Traits/ApcuTrait.php @@ -101,7 +101,7 @@ trait ApcuTrait /** * {@inheritdoc} */ - protected function doSave(array $values, ?int $lifetime) + protected function doSave(array $values, int $lifetime) { try { if (false === $failures = apcu_store($values, null, $lifetime)) { diff --git a/src/Symfony/Component/Cache/Traits/DoctrineTrait.php b/src/Symfony/Component/Cache/Traits/DoctrineTrait.php index f795e67868..98dc95e911 100644 --- a/src/Symfony/Component/Cache/Traits/DoctrineTrait.php +++ b/src/Symfony/Component/Cache/Traits/DoctrineTrait.php @@ -91,7 +91,7 @@ trait DoctrineTrait /** * {@inheritdoc} */ - protected function doSave(array $values, ?int $lifetime) + protected function doSave(array $values, int $lifetime) { return $this->provider->saveMultiple($values, $lifetime); } diff --git a/src/Symfony/Component/Cache/Traits/FilesystemTrait.php b/src/Symfony/Component/Cache/Traits/FilesystemTrait.php index fe8ab2bda3..aea8cd58f7 100644 --- a/src/Symfony/Component/Cache/Traits/FilesystemTrait.php +++ b/src/Symfony/Component/Cache/Traits/FilesystemTrait.php @@ -91,7 +91,7 @@ trait FilesystemTrait /** * {@inheritdoc} */ - protected function doSave(array $values, ?int $lifetime) + protected function doSave(array $values, int $lifetime) { $expiresAt = $lifetime ? (time() + $lifetime) : 0; $values = $this->marshaller->marshall($values, $failed); diff --git a/src/Symfony/Component/Cache/Traits/MemcachedTrait.php b/src/Symfony/Component/Cache/Traits/MemcachedTrait.php index 89abe35d6a..c03dc71061 100644 --- a/src/Symfony/Component/Cache/Traits/MemcachedTrait.php +++ b/src/Symfony/Component/Cache/Traits/MemcachedTrait.php @@ -223,7 +223,7 @@ trait MemcachedTrait /** * {@inheritdoc} */ - protected function doSave(array $values, ?int $lifetime) + protected function doSave(array $values, int $lifetime) { if (!$values = $this->marshaller->marshall($values, $failed)) { return $failed; diff --git a/src/Symfony/Component/Cache/Traits/PdoTrait.php b/src/Symfony/Component/Cache/Traits/PdoTrait.php index 5970ec4303..943d34e5eb 100644 --- a/src/Symfony/Component/Cache/Traits/PdoTrait.php +++ b/src/Symfony/Component/Cache/Traits/PdoTrait.php @@ -275,7 +275,7 @@ trait PdoTrait /** * {@inheritdoc} */ - protected function doSave(array $values, ?int $lifetime) + protected function doSave(array $values, int $lifetime) { if (!$values = $this->marshaller->marshall($values, $failed)) { return $failed; diff --git a/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php b/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php index 567bea1d1b..ac4d7ce9ca 100644 --- a/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php +++ b/src/Symfony/Component/Cache/Traits/PhpFilesTrait.php @@ -194,7 +194,7 @@ trait PhpFilesTrait /** * {@inheritdoc} */ - protected function doSave(array $values, ?int $lifetime) + protected function doSave(array $values, int $lifetime) { $ok = true; $expiry = $lifetime ? time() + $lifetime : 'PHP_INT_MAX'; diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php index bd506999b6..322eeee19b 100644 --- a/src/Symfony/Component/Cache/Traits/RedisTrait.php +++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php @@ -404,7 +404,7 @@ trait RedisTrait /** * {@inheritdoc} */ - protected function doSave(array $values, ?int $lifetime) + protected function doSave(array $values, int $lifetime) { if (!$values = $this->marshaller->marshall($values, $failed)) { return $failed;