From 4c2d32ce11b6e239eff502bdafe090f7fef9625d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Thu, 10 Sep 2020 00:08:02 +0200 Subject: [PATCH] Fix wrong interface for MongoDbStore --- UPGRADE-5.2.md | 5 +++++ src/Symfony/Component/Lock/CHANGELOG.md | 5 +++++ src/Symfony/Component/Lock/Store/MongoDbStore.php | 13 ++----------- .../Component/Lock/Tests/Store/MongoDbStoreTest.php | 12 ------------ 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/UPGRADE-5.2.md b/UPGRADE-5.2.md index ac5518d2ed..0f0c4567ad 100644 --- a/UPGRADE-5.2.md +++ b/UPGRADE-5.2.md @@ -16,6 +16,11 @@ FrameworkBundle used to be added by default to the seed, which is not the case anymore. This allows sharing caches between apps or different environments. +Lock +---- + + * `MongoDbStore` does not implement `BlockingStoreInterface` anymore, typehint against `PersistingStoreInterface` instead. + Mime ---- diff --git a/src/Symfony/Component/Lock/CHANGELOG.md b/src/Symfony/Component/Lock/CHANGELOG.md index 66a3acbb76..8254caf78d 100644 --- a/src/Symfony/Component/Lock/CHANGELOG.md +++ b/src/Symfony/Component/Lock/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +5.2.0 +----- + + * `MongoDbStore` does not implement `BlockingStoreInterface` anymore, typehint against `PersistingStoreInterface` instead. + 5.1.0 ----- diff --git a/src/Symfony/Component/Lock/Store/MongoDbStore.php b/src/Symfony/Component/Lock/Store/MongoDbStore.php index 5959c5c16b..b228d2b7ac 100644 --- a/src/Symfony/Component/Lock/Store/MongoDbStore.php +++ b/src/Symfony/Component/Lock/Store/MongoDbStore.php @@ -19,15 +19,14 @@ use MongoDB\Driver\ReadPreference; use MongoDB\Exception\DriverRuntimeException; use MongoDB\Exception\InvalidArgumentException as MongoInvalidArgumentException; use MongoDB\Exception\UnsupportedException; -use Symfony\Component\Lock\BlockingStoreInterface; use Symfony\Component\Lock\Exception\InvalidArgumentException; use Symfony\Component\Lock\Exception\InvalidTtlException; use Symfony\Component\Lock\Exception\LockAcquiringException; use Symfony\Component\Lock\Exception\LockConflictedException; use Symfony\Component\Lock\Exception\LockExpiredException; use Symfony\Component\Lock\Exception\LockStorageException; -use Symfony\Component\Lock\Exception\NotSupportedException; use Symfony\Component\Lock\Key; +use Symfony\Component\Lock\PersistingStoreInterface; /** * MongoDbStore is a StoreInterface implementation using MongoDB as a storage @@ -46,7 +45,7 @@ use Symfony\Component\Lock\Key; * * @author Joe Bennett */ -class MongoDbStore implements BlockingStoreInterface +class MongoDbStore implements PersistingStoreInterface { private $collection; private $client; @@ -224,14 +223,6 @@ class MongoDbStore implements BlockingStoreInterface $this->checkNotExpired($key); } - /** - * {@inheritdoc} - */ - public function waitAndSave(Key $key) - { - throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', __CLASS__)); - } - /** * {@inheritdoc} * diff --git a/src/Symfony/Component/Lock/Tests/Store/MongoDbStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/MongoDbStoreTest.php index a8472a5ed7..cd6ab0a47b 100644 --- a/src/Symfony/Component/Lock/Tests/Store/MongoDbStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/MongoDbStoreTest.php @@ -14,7 +14,6 @@ namespace Symfony\Component\Lock\Tests\Store; use MongoDB\Client; use MongoDB\Driver\Exception\ConnectionTimeoutException; use Symfony\Component\Lock\Exception\InvalidArgumentException; -use Symfony\Component\Lock\Exception\NotSupportedException; use Symfony\Component\Lock\Key; use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\Store\MongoDbStore; @@ -81,17 +80,6 @@ class MongoDbStoreTest extends AbstractStoreTest $this->assertContains('expires_at_1', $indexes); } - public function testNonBlocking() - { - $this->expectException(NotSupportedException::class); - - $store = $this->getStore(); - - $key = new Key(uniqid(__METHOD__, true)); - - $store->waitAndSave($key); - } - /** * @dataProvider provideConstructorArgs */