diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php index 6f349ab433ef8..802c30fa92d9e 100644 --- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php @@ -67,11 +67,8 @@ function ($deferred) { /** * {@inheritdoc} */ - public function invalidateTags($tags) + public function invalidateTags(array $tags) { - if (!is_array($tags)) { - $tags = array($tags); - } foreach ($tags as $k => $tag) { if ('' !== $tag && is_string($tag)) { $tags[$k] = $tag.static::TAGS_PREFIX; diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapterInterface.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapterInterface.php index 6a493fa0f7d0f..340048c100021 100644 --- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapterInterface.php +++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapterInterface.php @@ -23,11 +23,11 @@ interface TagAwareAdapterInterface extends AdapterInterface /** * Invalidates cached items using tags. * - * @param string|string[] $tags A tag or an array of tags to invalidate + * @param string[] $tags An array of tags to invalidate * * @return bool True on success * * @throws InvalidArgumentException When $tags is not valid */ - public function invalidateTags($tags); + public function invalidateTags(array $tags); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php index fc824ede58868..83bdd3aaf5544 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php @@ -55,7 +55,7 @@ public function testInvalidateTags() $pool->save($i3->tag('foo')->tag('baz')); $pool->save($foo); - $pool->invalidateTags('bar'); + $pool->invalidateTags(array('bar')); $this->assertFalse($pool->getItem('i0')->isHit()); $this->assertTrue($pool->getItem('i1')->isHit()); @@ -63,7 +63,7 @@ public function testInvalidateTags() $this->assertTrue($pool->getItem('i3')->isHit()); $this->assertTrue($pool->getItem('foo')->isHit()); - $pool->invalidateTags('foo'); + $pool->invalidateTags(array('foo')); $this->assertFalse($pool->getItem('i1')->isHit()); $this->assertFalse($pool->getItem('i3')->isHit()); @@ -80,7 +80,7 @@ public function testTagsAreCleanedOnSave() $i = $pool->getItem('k'); $pool->save($i->tag('bar')); - $pool->invalidateTags('foo'); + $pool->invalidateTags(array('foo')); $this->assertTrue($pool->getItem('k')->isHit()); } @@ -93,7 +93,7 @@ public function testTagsAreCleanedOnDelete() $pool->deleteItem('k'); $pool->save($pool->getItem('k')); - $pool->invalidateTags('foo'); + $pool->invalidateTags(array('foo')); $this->assertTrue($pool->getItem('k')->isHit()); }