[Cache] fix bad merge

This commit is contained in:
Nicolas Grekas 2021-07-07 14:43:50 +02:00
parent d008bd6878
commit db20357bfb
8 changed files with 16 additions and 10 deletions

View File

@ -312,7 +312,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
$this->clear();
}
private function generateItems(array $keys, float $now, \Closure $f)
private function generateItems(array $keys, float $now, \Closure $f): \Generator
{
foreach ($keys as $i => $key) {
if (!$isHit = isset($this->expiries[$key]) && ($this->expiries[$key] > $now || !$this->deleteItem($key))) {

View File

@ -147,7 +147,7 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
return $this->generateItems($this->adapters[0]->getItems($keys), 0);
}
private function generateItems(iterable $items, int $adapterIndex)
private function generateItems(iterable $items, int $adapterIndex): \Generator
{
$missing = [];
$misses = [];

View File

@ -143,7 +143,7 @@ class NullAdapter implements AdapterInterface, CacheInterface
return $this->deleteItem($key);
}
private function generateItems(array $keys)
private function generateItems(array $keys): \Generator
{
$f = $this->createCacheItem;

View File

@ -244,7 +244,7 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
return $this->pool->$method($innerItem);
}
private function generateItems(iterable $items)
private function generateItems(iterable $items): \Generator
{
$f = $this->createCacheItem;

View File

@ -329,7 +329,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
$this->commit();
}
private function generateItems(iterable $items, array $tagKeys)
private function generateItems(iterable $items, array $tagKeys): \Generator
{
$bufferedItems = $itemTags = [];
$f = $this->setCacheItemTags;

View File

@ -76,9 +76,15 @@ final class CacheItem implements ItemInterface
*
* @return $this
*/
public function expiresAt(?\DateTimeInterface $expiration): self
public function expiresAt($expiration): self
{
$this->expiry = null !== $expiration ? (float) $expiration->format('U.u') : null;
if (null === $expiration) {
$this->expiry = null;
} elseif ($expiration instanceof \DateTimeInterface) {
$this->expiry = (float) $expiration->format('U.u');
} else {
throw new InvalidArgumentException(sprintf('Expiration date must implement DateTimeInterface or be null, "%s" given.', get_debug_type($expiration)));
}
return $this;
}

View File

@ -332,7 +332,7 @@ trait AbstractAdapterTrait
}
}
private function generateItems(iterable $items, array &$keys): iterable
private function generateItems(iterable $items, array &$keys): \Generator
{
$f = $this->createCacheItem;

View File

@ -84,9 +84,9 @@ trait RedisTrait
*
* @param array $options See self::$defaultConnectionOptions
*
* @throws InvalidArgumentException when the DSN is invalid
*
* @return \Redis|\RedisCluster|RedisClusterProxy|RedisProxy|\Predis\ClientInterface According to the "class" option
*
* @throws InvalidArgumentException when the DSN is invalid
*/
public static function createConnection(string $dsn, array $options = [])
{