8000 [Cache] Fix return types · symfony/symfony@a93b9ed · GitHub
[go: up one dir, main page]

Skip to content

Commit a93b9ed

Browse files
committed
[Cache] Fix return types
1 parent 05e87ec commit a93b9ed

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

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

+9-6
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ static function ($deferred) {
108108
*/
109109
public function prune()
110110
{
111-
$this->pool instanceof PruneableInterface && $this->pool->prune();
112-
$this->tagPool instanceof PruneableInterface && $this->tagPool->prune();
111+
$isPruned = $this->pool instanceof PruneableInterface && $this->pool->prune();
112+
113+
return $this->tagPool instanceof PruneableInterface && $this->tagPool->prune() && $isPruned;
113114
}
114115

115116
/**
@@ -422,7 +423,7 @@ protected function getTagVersions(array $tags): array
422423
*
423424
* @throws \Psr\Cache\InvalidArgumentException
424425
*
425-
* @return string[]
426+
* @return array
426427
*/
427428
protected function retrieveTagVersions(array $tags): array
428429
{
@@ -433,8 +434,8 @@ protected function retrieveTagVersions(array $tags): array
433434
$newTagVersion = $this->generateTagVersion();
434435
$tagVersions = $generated = [];
435436
foreach ($this->tagPool->getItems(array_keys($tagIds)) as $tagId => $version) {
436-
if ($version->isHit() && is_scalar($tagVersion = $version->get())) {
437-
$tagVersions[$tagIds[$tagId]] = $tagVersion;
437+
if ($version->isHit()) {
438+
$tagVersions[$tagIds[$tagId]] = $version->get();
438439
continue;
439440
}
440441
$version->set($newTagVersion);
@@ -478,8 +479,10 @@ protected function getTagIdsMap(array $tags): array
478479

479480
/**
480481
* Generates unique string for robust tag versioning.
482+
*
483+
* @return mixed
481484
*/
482-
abstract protected function generateTagVersion(): string;
485+
abstract protected function generateTagVersion();
483486

484487
/**
485488
* Checks a set of tag versions against available current ones.

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function getItem($key): CacheItem
117117
/**
118118
* {@inheritdoc}
119119
*/
120-
public function getItems(array $keys = []): array
120+
public function getItems(array $keys = [])
121121
{
122122
// Force retrieving the tags
123123
$this->clearLastRetrievedTagVersions();
@@ -256,7 +256,7 @@ protected function getTagVersions(array $tags): array
256256
/**
257257
* {@inheritDoc}
258258
*/
259-
protected function generateTagVersion(): string
259+
protected function generateTagVersion()
260260
{
261261
$tod = gettimeofday();
262262

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class RedisEphemeralTagAwareAdapter extends EphemeralTagAwareAdapter implements
7474
/**
7575
* Strategy which creates Generator of SET NX instructions for specific redis client.
7676
*
77-
* @var Closure
77+
* @var \Closure
7878
*/
7979
private $setNxGenerator;
8080

0 commit comments

Comments
 (0)
0