Skip to content

Commit db20357

Browse files
[Cache] fix bad merge
1 parent d008bd6 commit db20357

File tree

8 files changed

+16
-10
lines changed

8 files changed

+16
-10
lines changed

src/Symfony/Component/Cache/Adapter/ArrayAdapter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ public function reset()
312312
$this->clear();
313313
}
314314

315-
private function generateItems(array $keys, float $now, \Closure $f)
315+
private function generateItems(array $keys, float $now, \Closure $f): \Generator
316316
{
317317
foreach ($keys as $i => $key) {
318318
if (!$isHit = isset($this->expiries[$key]) && ($this->expiries[$key] > $now || !$this->deleteItem($key))) {

src/Symfony/Component/Cache/Adapter/ChainAdapter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function getItems(array $keys = [])
147147
return $this->generateItems($this->adapters[0]->getItems($keys), 0);
148148
}
149149

150-
private function generateItems(iterable $items, int $adapterIndex)
150+
private function generateItems(iterable $items, int $adapterIndex): \Generator
151151
{
152152
$missing = [];
153153
$misses = [];

src/Symfony/Component/Cache/Adapter/NullAdapter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function delete(string $key): bool
143143
return $this->deleteItem($key);
144144
}
145145

146-
private function generateItems(array $keys)
146+
private function generateItems(array $keys): \Generator
147147
{
148148
$f = $this->createCacheItem;
149149

src/Symfony/Component/Cache/Adapter/ProxyAdapter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ private function doSave(CacheItemInterface $item, string $method)
244244
return $this->pool->$method($innerItem);
245245
}
246246

247-
private function generateItems(iterable $items)
247+
private function generateItems(iterable $items): \Generator
248248
{
249249
$f = $this->createCacheItem;
250250

src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public function __destruct()
329329
$this->commit();
330330
}
331331

332-
private function generateItems(iterable $items, array $tagKeys)
332+
private function generateItems(iterable $items, array $tagKeys): \Generator
333333
{
334334
$bufferedItems = $itemTags = [];
335335
$f = $this->setCacheItemTags;

src/Symfony/Component/Cache/CacheItem.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,15 @@ public function set($value): self
7676
*
7777
* @return $this
7878
*/
79-
public function expiresAt(?\DateTimeInterface $expiration): self
79+
public function expiresAt($expiration): self
8080
{
81-
$this->expiry = null !== $expiration ? (float) $expiration->format('U.u') : null;
81+
if (null === $expiration) {
82+
$this->expiry = null;
83+
} elseif ($expiration instanceof \DateTimeInterface) {
84+
$this->expiry = (float) $expiration->format('U.u');
85+
} else {
86+
throw new InvalidArgumentException(sprintf('Expiration date must implement DateTimeInterface or be null, "%s" given.', get_debug_type($expiration)));
87+
}
8288

8389
return $this;
8490
}

src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public function __destruct()
332332
}
333333
}
334334

335-
private function generateItems(iterable $items, array &$keys): iterable
335+
private function generateItems(iterable $items, array &$keys): \Generator
336336
{
337337
$f = $this->createCacheItem;
338338

src/Symfony/Component/Cache/Traits/RedisTrait.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ private function init($redis, string $namespace, int $defaultLifetime, ?Marshall
8484
*
8585
* @param array $options See self::$defaultConnectionOptions
8686
*
87-
* @throws InvalidArgumentException when the DSN is invalid
88-
*
8987
* @return \Redis|\RedisCluster|RedisClusterProxy|RedisProxy|\Predis\ClientInterface According to the "class" option
88+
*
89+
* @throws InvalidArgumentException when the DSN is invalid
9090
*/
9191
public static function createConnection(string $dsn, array $options = [])
9292
{

0 commit comments

Comments
 (0)