Skip to content

Commit f73b985

Browse files
Merge branch '5.2' into 5.3
* 5.2: [Cache] fix bad merge
2 parents 6ed4ce0 + db20357 commit f73b985

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
@@ -306,7 +306,7 @@ public function reset()
306306
$this->clear();
307307
}
308308

309-
private function generateItems(array $keys, float $now, \Closure $f)
309+
private function generateItems(array $keys, float $now, \Closure $f): \Generator
310310
{
311311
foreach ($keys as $i => $key) {
312312
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
@@ -150,7 +150,7 @@ public function getItems(array $keys = [])
150150
return $this->generateItems($this->adapters[0]->getItems($keys), 0);
151151
}
152152

153-
private function generateItems(iterable $items, int $adapterIndex)
153+
private function generateItems(iterable $items, int $adapterIndex): \Generator
154154
{
155155
$missing = [];
156156
$misses = [];

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

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

144-
private function generateItems(array $keys)
144+
private function generateItems(array $keys): \Generator
145145
{
146146
$f = self::$createCacheItem;
147147

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

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

249-
private function generateItems(iterable $items)
249+
private function generateItems(iterable $items): \Generator
250250
{
251251
$f = self::$createCacheItem;
252252

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

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

331-
private function generateItems(iterable $items, array $tagKeys)
331+
private function generateItems(iterable $items, array $tagKeys): \Generator
332332
{
333333
$bufferedItems = $itemTags = [];
334334
$f = self::$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 = self::$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)