Skip to content

Commit f59a7e1

Browse files
committed
Fix withGroup issue
1 parent eb909c8 commit f59a7e1

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

packages/cache/src/TaggedCachePool.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
class TaggedCachePool extends CachePool implements TaggedCachePoolInterface
2222
{
2323
private const string TAG_VER_PREFIX = '--ww_tag_ver--';
24+
2425
private const string TAG_ENV_PREFIX = '--ww_tag_env--';
2526

2627
protected CacheItemPoolInterface $tagPool;
@@ -165,7 +166,10 @@ public function withGroup(string $group): static
165166
{
166167
$new = parent::withGroup($group);
167168

168-
if ($new->tagPool instanceof self && $new->tagPool->isGroupSupported()) {
169+
if (
170+
$new->tagPool instanceof CachePoolInterface
171+
&& $new->tagPool->isGroupSupported()
172+
) {
169173
$new->tagPool = $new->tagPool->withGroup($group);
170174
}
171175

@@ -240,7 +244,7 @@ private function generateTagVersion(): string
240244
return bin2hex(random_bytes(8));
241245
}
242246

243-
/** @param string[] $tags
247+
/** @param string[] $tags
244248
* @return array<string, string>
245249
*/
246250
private function getCurrentTagVersions(array $tags): array
@@ -295,7 +299,7 @@ private function getCurrentTagVersions(array $tags): array
295299
return $versions;
296300
}
297301

298-
/** @param string[] $tags */
302+
/** @param string[] $tags */
299303
private function saveTagEnvelope(string $key, array $tags, int $expiration): void
300304
{
301305
$envelope = $this->getOrCreateTagVersions($tags);
@@ -307,7 +311,7 @@ private function saveTagEnvelope(string $key, array $tags, int $expiration): voi
307311
$this->tagPool->save($item);
308312
}
309313

310-
/** @param string[] $tags
314+
/** @param string[] $tags
311315
* @return array<string, string>
312316
*/
313317
private function getOrCreateTagVersions(array $tags): array
@@ -346,7 +350,7 @@ private function getOrCreateTagVersions(array $tags): array
346350
return $versions;
347351
}
348352

349-
/** @param string[] $tags */
353+
/** @param string[] $tags */
350354
private function isTagValid(string $key, array $tags): bool
351355
{
352356
$item = $this->tagPool->getItem($this->tagEnvelopeKey($key));

0 commit comments

Comments
 (0)