[Cache] $lifetime cannot be null

This commit is contained in:
Nicolas Grekas 2020-05-23 15:02:18 +02:00
parent 236a2145fc
commit c8c7d4c458
12 changed files with 12 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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