From 8173c475f34d6ea0cf2c1f66dd0168d61566772b Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Thu, 11 Jul 2019 05:40:49 +0200 Subject: [PATCH] [Lock] feature: lock split interface fix post-merge review --- UPGRADE-4.4.md | 2 +- UPGRADE-5.0.md | 2 +- .../FrameworkExtension.php | 8 ++-- .../Component/Lock/BlockingStoreInterface.php | 9 ---- src/Symfony/Component/Lock/CHANGELOG.md | 2 +- src/Symfony/Component/Lock/Lock.php | 12 ++--- ...rface.php => PersistingStoreInterface.php} | 2 +- .../Component/Lock/Store/CombinedStore.php | 22 ++++----- .../Component/Lock/Store/FlockStore.php | 8 ---- .../Component/Lock/Store/MemcachedStore.php | 4 +- .../Component/Lock/Store/RedisStore.php | 2 + .../Lock/Store/RetryTillSaveStore.php | 20 +++----- .../Component/Lock/Store/SemaphoreStore.php | 8 ---- .../Component/Lock/Store/ZookeeperStore.php | 2 + src/Symfony/Component/Lock/StoreInterface.php | 4 +- src/Symfony/Component/Lock/Tests/LockTest.php | 47 ++++++++----------- .../Lock/Tests/Store/AbstractStoreTest.php | 4 +- .../Tests/Store/BlockingStoreTestTrait.php | 4 +- .../Lock/Tests/Store/CombinedStoreTest.php | 10 ++-- 19 files changed, 66 insertions(+), 106 deletions(-) rename src/Symfony/Component/Lock/{PersistStoreInterface.php => PersistingStoreInterface.php} (97%) diff --git a/UPGRADE-4.4.md b/UPGRADE-4.4.md index 67a2c8ba84..011ffb649b 100644 --- a/UPGRADE-4.4.md +++ b/UPGRADE-4.4.md @@ -99,7 +99,7 @@ Lock ---- * Deprecated `Symfony\Component\Lock\StoreInterface` in favor of `Symfony\Component\Lock\BlockingStoreInterface` and - `Symfony\Component\Lock\PersistStoreInterface`. + `Symfony\Component\Lock\PersistingStoreInterface`. * `Factory` is deprecated, use `LockFactory` instead Messenger diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index 40c38088e5..4cc6cda9c8 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -306,7 +306,7 @@ Lock ---- * Removed `Symfony\Component\Lock\StoreInterface` in favor of `Symfony\Component\Lock\BlockingStoreInterface` and - `Symfony\Component\Lock\PersistStoreInterface`. + `Symfony\Component\Lock\PersistingStoreInterface`. * Removed `Factory`, use `LockFactory` instead Messenger diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 6a3f6aa086..84276ef97d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -73,7 +73,7 @@ use Symfony\Component\Lock\Factory; use Symfony\Component\Lock\Lock; use Symfony\Component\Lock\LockFactory; use Symfony\Component\Lock\LockInterface; -use Symfony\Component\Lock\PersistStoreInterface; +use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\Store\FlockStore; use Symfony\Component\Lock\Store\StoreFactory; use Symfony\Component\Lock\StoreInterface; @@ -1606,7 +1606,7 @@ class FrameworkExtension extends Extension $container->setDefinition($connectionDefinitionId, $connectionDefinition); } - $storeDefinition = new Definition(PersistStoreInterface::class); + $storeDefinition = new Definition(PersistingStoreInterface::class); $storeDefinition->setPublic(false); $storeDefinition->setFactory([StoreFactory::class, 'createStore']); $storeDefinition->setArguments([new Reference($connectionDefinitionId)]); @@ -1649,13 +1649,13 @@ class FrameworkExtension extends Extension $container->setAlias('lock.factory', new Alias('lock.'.$resourceName.'.factory', false)); $container->setAlias('lock', new Alias('lock.'.$resourceName, false)); $container->setAlias(StoreInterface::class, new Alias('lock.store', false)); - $container->setAlias(PersistStoreInterface::class, new Alias('lock.store', false)); + $container->setAlias(PersistingStoreInterface::class, new Alias('lock.store', false)); $container->setAlias(Factory::class, new Alias('lock.factory', false)); $container->setAlias(LockFactory::class, new Alias('lock.factory', false)); $container->setAlias(LockInterface::class, new Alias('lock', false)); } else { $container->registerAliasForArgument('lock.'.$resourceName.'.store', StoreInterface::class, $resourceName.'.lock.store'); - $container->registerAliasForArgument('lock.'.$resourceName.'.store', PersistStoreInterface::class, $resourceName.'.lock.store'); + $container->registerAliasForArgument('lock.'.$resourceName.'.store', PersistingStoreInterface::class, $resourceName.'.lock.store'); $container->registerAliasForArgument('lock.'.$resourceName.'.factory', Factory::class, $resourceName.'.lock.factory'); $container->registerAliasForArgument('lock.'.$resourceName.'.factory', LockFactory::class, $resourceName.'.lock.factory'); $container->registerAliasForArgument('lock.'.$resourceName, LockInterface::class, $resourceName.'.lock'); diff --git a/src/Symfony/Component/Lock/BlockingStoreInterface.php b/src/Symfony/Component/Lock/BlockingStoreInterface.php index 220e922be2..162c9b3d41 100644 --- a/src/Symfony/Component/Lock/BlockingStoreInterface.php +++ b/src/Symfony/Component/Lock/BlockingStoreInterface.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Lock; use Symfony\Component\Lock\Exception\LockConflictedException; -use Symfony\Component\Lock\Exception\NotSupportedException; /** * @author Hamza Amrouche @@ -22,15 +21,7 @@ interface BlockingStoreInterface /** * Waits until a key becomes free, then stores the resource. * - * If the store does not support this feature it should throw a NotSupportedException. - * * @throws LockConflictedException - * @throws NotSupportedException */ public function waitAndSave(Key $key); - - /** - * Checks if the store can wait until a key becomes free before storing the resource. - */ - public function supportsWaitAndSave(): bool; } diff --git a/src/Symfony/Component/Lock/CHANGELOG.md b/src/Symfony/Component/Lock/CHANGELOG.md index 65dd191adc..cb193f4681 100644 --- a/src/Symfony/Component/Lock/CHANGELOG.md +++ b/src/Symfony/Component/Lock/CHANGELOG.md @@ -5,7 +5,7 @@ CHANGELOG ----- * added InvalidTtlException - * deprecated `Symfony\Component\Lock\StoreInterface` in favor of `Symfony\Component\Lock\BlockingStoreInterface` and `Symfony\Component\Lock\PersistStoreInterface` + * deprecated `StoreInterface` in favor of `BlockingStoreInterface` and `PersistingStoreInterface` 4.2.0 ----- diff --git a/src/Symfony/Component/Lock/Lock.php b/src/Symfony/Component/Lock/Lock.php index e79f4a0d21..534508bfc4 100644 --- a/src/Symfony/Component/Lock/Lock.php +++ b/src/Symfony/Component/Lock/Lock.php @@ -37,12 +37,12 @@ final class Lock implements LockInterface, LoggerAwareInterface private $dirty = false; /** - * @param Key $key Resource to lock - * @param PersistStoreInterface $store Store used to handle lock persistence - * @param float|null $ttl Maximum expected lock duration in seconds - * @param bool $autoRelease Whether to automatically release the lock or not when the lock instance is destroyed + * @param Key $key Resource to lock + * @param PersistingStoreInterface $store Store used to handle lock persistence + * @param float|null $ttl Maximum expected lock duration in seconds + * @param bool $autoRelease Whether to automatically release the lock or not when the lock instance is destroyed */ - public function __construct(Key $key, PersistStoreInterface $store, float $ttl = null, bool $autoRelease = true) + public function __construct(Key $key, PersistingStoreInterface $store, float $ttl = null, bool $autoRelease = true) { $this->store = $store; $this->key = $key; @@ -71,7 +71,7 @@ final class Lock implements LockInterface, LoggerAwareInterface { try { if ($blocking) { - if (!$this->store instanceof StoreInterface && !($this->store instanceof BlockingStoreInterface && $this->store->supportsWaitAndSave())) { + if (!$this->store instanceof StoreInterface && !$this->store instanceof BlockingStoreInterface) { throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this->store))); } $this->store->waitAndSave($this->key); diff --git a/src/Symfony/Component/Lock/PersistStoreInterface.php b/src/Symfony/Component/Lock/PersistingStoreInterface.php similarity index 97% rename from src/Symfony/Component/Lock/PersistStoreInterface.php rename to src/Symfony/Component/Lock/PersistingStoreInterface.php index b79ad3bf8f..f3095db0c0 100644 --- a/src/Symfony/Component/Lock/PersistStoreInterface.php +++ b/src/Symfony/Component/Lock/PersistingStoreInterface.php @@ -18,7 +18,7 @@ use Symfony\Component\Lock\Exception\LockReleasingException; /** * @author Jérémy Derussé */ -interface PersistStoreInterface +interface PersistingStoreInterface { /** * Stores the resource if it's not locked by someone else. diff --git a/src/Symfony/Component/Lock/Store/CombinedStore.php b/src/Symfony/Component/Lock/Store/CombinedStore.php index b5891af830..2ad93d0952 100644 --- a/src/Symfony/Component/Lock/Store/CombinedStore.php +++ b/src/Symfony/Component/Lock/Store/CombinedStore.php @@ -18,7 +18,7 @@ use Symfony\Component\Lock\Exception\InvalidArgumentException; use Symfony\Component\Lock\Exception\LockConflictedException; use Symfony\Component\Lock\Exception\NotSupportedException; use Symfony\Component\Lock\Key; -use Symfony\Component\Lock\PersistStoreInterface; +use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\StoreInterface; use Symfony\Component\Lock\Strategy\StrategyInterface; @@ -32,22 +32,22 @@ class CombinedStore implements StoreInterface, LoggerAwareInterface use LoggerAwareTrait; use ExpiringStoreTrait; - /** @var PersistStoreInterface[] */ + /** @var PersistingStoreInterface[] */ private $stores; /** @var StrategyInterface */ private $strategy; /** - * @param PersistStoreInterface[] $stores The list of synchronized stores - * @param StrategyInterface $strategy + * @param PersistingStoreInterface[] $stores The list of synchronized stores + * @param StrategyInterface $strategy * * @throws InvalidArgumentException */ public function __construct(array $stores, StrategyInterface $strategy) { foreach ($stores as $store) { - if (!$store instanceof PersistStoreInterface) { - throw new InvalidArgumentException(sprintf('The store must implement "%s". Got "%s".', PersistStoreInterface::class, \get_class($store))); + if (!$store instanceof PersistingStoreInterface) { + throw new InvalidArgumentException(sprintf('The store must implement "%s". Got "%s".', PersistingStoreInterface::class, \get_class($store))); } } @@ -95,6 +95,8 @@ class CombinedStore implements StoreInterface, LoggerAwareInterface /** * {@inheritdoc} + * + * @deprecated since Symfony 4.4. */ public function waitAndSave(Key $key) { @@ -186,12 +188,4 @@ class CombinedStore implements StoreInterface, LoggerAwareInterface return false; } - - /** - * {@inheritdoc} - */ - public function supportsWaitAndSave(): bool - { - return false; - } } diff --git a/src/Symfony/Component/Lock/Store/FlockStore.php b/src/Symfony/Component/Lock/Store/FlockStore.php index 64721a300a..cf97434616 100644 --- a/src/Symfony/Component/Lock/Store/FlockStore.php +++ b/src/Symfony/Component/Lock/Store/FlockStore.php @@ -65,14 +65,6 @@ class FlockStore implements StoreInterface, BlockingStoreInterface $this->lock($key, true); } - /** - * {@inheritdoc} - */ - public function supportsWaitAndSave(): bool - { - return true; - } - private function lock(Key $key, $blocking) { // The lock is maybe already acquired. diff --git a/src/Symfony/Component/Lock/Store/MemcachedStore.php b/src/Symfony/Component/Lock/Store/MemcachedStore.php index 962f143c76..3bfa87cdbc 100644 --- a/src/Symfony/Component/Lock/Store/MemcachedStore.php +++ b/src/Symfony/Component/Lock/Store/MemcachedStore.php @@ -71,10 +71,12 @@ class MemcachedStore implements StoreInterface /** * {@inheritdoc} + * + * @deprecated since Symfony 4.4. */ public function waitAndSave(Key $key) { - @trigger_error(sprintf('%s() is deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', __METHOD__)); + @trigger_error(sprintf('%s() is deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', __METHOD__), E_USER_DEPRECATED); throw new InvalidArgumentException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this))); } diff --git a/src/Symfony/Component/Lock/Store/RedisStore.php b/src/Symfony/Component/Lock/Store/RedisStore.php index 4ac41ac347..4e8533d463 100644 --- a/src/Symfony/Component/Lock/Store/RedisStore.php +++ b/src/Symfony/Component/Lock/Store/RedisStore.php @@ -74,6 +74,8 @@ class RedisStore implements StoreInterface /** * {@inheritdoc} + * + * @deprecated since Symfony 4.4. */ public function waitAndSave(Key $key) { diff --git a/src/Symfony/Component/Lock/Store/RetryTillSaveStore.php b/src/Symfony/Component/Lock/Store/RetryTillSaveStore.php index 4c66e3ba82..87ae87e153 100644 --- a/src/Symfony/Component/Lock/Store/RetryTillSaveStore.php +++ b/src/Symfony/Component/Lock/Store/RetryTillSaveStore.php @@ -17,7 +17,7 @@ use Psr\Log\NullLogger; use Symfony\Component\Lock\BlockingStoreInterface; use Symfony\Component\Lock\Exception\LockConflictedException; use Symfony\Component\Lock\Key; -use Symfony\Component\Lock\PersistStoreInterface; +use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\StoreInterface; /** @@ -26,7 +26,7 @@ use Symfony\Component\Lock\StoreInterface; * * @author Jérémy Derussé */ -class RetryTillSaveStore implements PersistStoreInterface, BlockingStoreInterface, StoreInterface, LoggerAwareInterface +class RetryTillSaveStore implements PersistingStoreInterface, BlockingStoreInterface, StoreInterface, LoggerAwareInterface { use LoggerAwareTrait; @@ -35,11 +35,11 @@ class RetryTillSaveStore implements PersistStoreInterface, BlockingStoreInterfac private $retryCount; /** - * @param PersistStoreInterface $decorated The decorated StoreInterface - * @param int $retrySleep Duration in ms between 2 retry - * @param int $retryCount Maximum amount of retry + * @param PersistingStoreInterface $decorated The decorated StoreInterface + * @param int $retrySleep Duration in ms between 2 retry + * @param int $retryCount Maximum amount of retry */ - public function __construct(PersistStoreInterface $decorated, int $retrySleep = 100, int $retryCount = PHP_INT_MAX) + public function __construct(PersistingStoreInterface $decorated, int $retrySleep = 100, int $retryCount = PHP_INT_MAX) { $this->decorated = $decorated; $this->retrySleep = $retrySleep; @@ -101,12 +101,4 @@ class RetryTillSaveStore implements PersistStoreInterface, BlockingStoreInterfac { return $this->decorated->exists($key); } - - /** - * {@inheritdoc} - */ - public function supportsWaitAndSave(): bool - { - return true; - } } diff --git a/src/Symfony/Component/Lock/Store/SemaphoreStore.php b/src/Symfony/Component/Lock/Store/SemaphoreStore.php index 293a3a7e6a..66ee7b570e 100644 --- a/src/Symfony/Component/Lock/Store/SemaphoreStore.php +++ b/src/Symfony/Component/Lock/Store/SemaphoreStore.php @@ -113,12 +113,4 @@ class SemaphoreStore implements StoreInterface, BlockingStoreInterface { return $key->hasState(__CLASS__); } - - /** - * {@inheritdoc} - */ - public function supportsWaitAndSave(): bool - { - return true; - } } diff --git a/src/Symfony/Component/Lock/Store/ZookeeperStore.php b/src/Symfony/Component/Lock/Store/ZookeeperStore.php index d089590f88..b751b56a75 100644 --- a/src/Symfony/Component/Lock/Store/ZookeeperStore.php +++ b/src/Symfony/Component/Lock/Store/ZookeeperStore.php @@ -84,6 +84,8 @@ class ZookeeperStore implements StoreInterface /** * {@inheritdoc} + * + * @deprecated since Symfony 4.4. */ public function waitAndSave(Key $key) { diff --git a/src/Symfony/Component/Lock/StoreInterface.php b/src/Symfony/Component/Lock/StoreInterface.php index 883136ed5a..5bd60cd5ce 100644 --- a/src/Symfony/Component/Lock/StoreInterface.php +++ b/src/Symfony/Component/Lock/StoreInterface.php @@ -19,9 +19,9 @@ use Symfony\Component\Lock\Exception\NotSupportedException; * * @author Jérémy Derussé * - * @deprecated "Symfony\Component\Lock\StoreInterface" is deprecated since Symfony 4.4 and has been split into "Symfony\Component\Lock\PersistStoreInterface", "Symfony\Component\Lock\BlockingStoreInterface".' + * @deprecated since Symfony 4.4, use PersistingStoreInterface and BlockingStoreInterface instead */ -interface StoreInterface extends PersistStoreInterface +interface StoreInterface extends PersistingStoreInterface { /** * Waits until a key becomes free, then stores the resource. diff --git a/src/Symfony/Component/Lock/Tests/LockTest.php b/src/Symfony/Component/Lock/Tests/LockTest.php index 9faf05d12c..87331a64cf 100644 --- a/src/Symfony/Component/Lock/Tests/LockTest.php +++ b/src/Symfony/Component/Lock/Tests/LockTest.php @@ -17,7 +17,7 @@ use Symfony\Component\Lock\BlockingStoreInterface; use Symfony\Component\Lock\Exception\LockConflictedException; use Symfony\Component\Lock\Key; use Symfony\Component\Lock\Lock; -use Symfony\Component\Lock\PersistStoreInterface; +use Symfony\Component\Lock\PersistingStoreInterface; /** * @author Jérémy Derussé @@ -27,7 +27,7 @@ class LockTest extends TestCase public function testAcquireNoBlocking() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store); $store @@ -40,7 +40,7 @@ class LockTest extends TestCase public function testAcquireNoBlockingStoreInterface() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store); $store @@ -52,13 +52,11 @@ class LockTest extends TestCase /** * @group legacy - * - * @deprecated */ public function testPassingOldStoreInterface() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store); $store @@ -71,7 +69,7 @@ class LockTest extends TestCase public function testAcquireReturnsFalse() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store); $store @@ -85,7 +83,7 @@ class LockTest extends TestCase public function testAcquireReturnsFalseStoreInterface() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store); $store @@ -99,13 +97,8 @@ class LockTest extends TestCase public function testAcquireBlocking() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder([PersistStoreInterface::class, BlockingStoreInterface::class])->getMock(); + $store = $this->getMockBuilder([PersistingStoreInterface::class, BlockingStoreInterface::class])->getMock(); $lock = new Lock($key, $store); - $store - ->expects($this->once()) - ->method('supportsWaitAndSave') - ->with() - ->willReturn(true); $store ->expects($this->never()) @@ -120,7 +113,7 @@ class LockTest extends TestCase public function testAcquireSetsTtl() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store, 10); $store @@ -137,7 +130,7 @@ class LockTest extends TestCase public function testRefresh() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store, 10); $store @@ -151,7 +144,7 @@ class LockTest extends TestCase public function testRefreshCustom() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store, 10); $store @@ -165,7 +158,7 @@ class LockTest extends TestCase public function testIsAquired() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store, 10); $store @@ -180,7 +173,7 @@ class LockTest extends TestCase public function testRelease() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store, 10); $store @@ -200,7 +193,7 @@ class LockTest extends TestCase public function testReleaseStoreInterface() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store, 10); $store @@ -220,7 +213,7 @@ class LockTest extends TestCase public function testReleaseOnDestruction() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder([PersistStoreInterface::class, BlockingStoreInterface::class])->getMock(); + $store = $this->getMockBuilder([PersistingStoreInterface::class, BlockingStoreInterface::class])->getMock(); $lock = new Lock($key, $store, 10); $store @@ -239,7 +232,7 @@ class LockTest extends TestCase public function testNoAutoReleaseWhenNotConfigured() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder([PersistStoreInterface::class, BlockingStoreInterface::class])->getMock(); + $store = $this->getMockBuilder([PersistingStoreInterface::class, BlockingStoreInterface::class])->getMock(); $lock = new Lock($key, $store, 10, false); $store @@ -261,7 +254,7 @@ class LockTest extends TestCase public function testReleaseThrowsExceptionWhenDeletionFail() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store, 10); $store @@ -284,7 +277,7 @@ class LockTest extends TestCase public function testReleaseThrowsExceptionIfNotWellDeleted() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store, 10); $store @@ -307,7 +300,7 @@ class LockTest extends TestCase public function testReleaseThrowsAndLog() { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); $lock = new Lock($key, $store, 10, true); $lock->setLogger($logger); @@ -336,7 +329,7 @@ class LockTest extends TestCase public function testExpiration($ttls, $expected) { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store, 10); foreach ($ttls as $ttl) { @@ -355,7 +348,7 @@ class LockTest extends TestCase public function testExpirationStoreInterface($ttls, $expected) { $key = new Key(uniqid(__METHOD__, true)); - $store = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $lock = new Lock($key, $store, 10); foreach ($ttls as $ttl) { diff --git a/src/Symfony/Component/Lock/Tests/Store/AbstractStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/AbstractStoreTest.php index 4039d8fd95..8159cd7f76 100644 --- a/src/Symfony/Component/Lock/Tests/Store/AbstractStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/AbstractStoreTest.php @@ -14,7 +14,7 @@ namespace Symfony\Component\Lock\Tests\Store; use PHPUnit\Framework\TestCase; use Symfony\Component\Lock\Exception\LockConflictedException; use Symfony\Component\Lock\Key; -use Symfony\Component\Lock\PersistStoreInterface; +use Symfony\Component\Lock\PersistingStoreInterface; /** * @author Jérémy Derussé @@ -22,7 +22,7 @@ use Symfony\Component\Lock\PersistStoreInterface; abstract class AbstractStoreTest extends TestCase { /** - * @return PersistStoreInterface + * @return PersistingStoreInterface */ abstract protected function getStore(); diff --git a/src/Symfony/Component/Lock/Tests/Store/BlockingStoreTestTrait.php b/src/Symfony/Component/Lock/Tests/Store/BlockingStoreTestTrait.php index 1ac99980b5..9c9ecdcd2f 100644 --- a/src/Symfony/Component/Lock/Tests/Store/BlockingStoreTestTrait.php +++ b/src/Symfony/Component/Lock/Tests/Store/BlockingStoreTestTrait.php @@ -14,7 +14,7 @@ namespace Symfony\Component\Lock\Tests\Store; use Symfony\Component\Lock\Exception\LockConflictedException; use Symfony\Component\Lock\Exception\NotSupportedException; use Symfony\Component\Lock\Key; -use Symfony\Component\Lock\PersistStoreInterface; +use Symfony\Component\Lock\PersistingStoreInterface; /** * @author Jérémy Derussé @@ -24,7 +24,7 @@ trait BlockingStoreTestTrait /** * @see AbstractStoreTest::getStore() * - * @return PersistStoreInterface + * @return PersistingStoreInterface */ abstract protected function getStore(); diff --git a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php index 3292247fde..0f77d103d5 100644 --- a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php @@ -14,7 +14,7 @@ namespace Symfony\Component\Lock\Tests\Store; use Symfony\Component\Lock\BlockingStoreInterface; use Symfony\Component\Lock\Exception\LockConflictedException; use Symfony\Component\Lock\Key; -use Symfony\Component\Lock\PersistStoreInterface; +use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\Store\CombinedStore; use Symfony\Component\Lock\Store\RedisStore; use Symfony\Component\Lock\Strategy\StrategyInterface; @@ -62,8 +62,8 @@ class CombinedStoreTest extends AbstractStoreTest protected function setUp() { $this->strategy = $this->getMockBuilder(StrategyInterface::class)->getMock(); - $this->store1 = $this->getMockBuilder([PersistStoreInterface::class, BlockingStoreInterface::class])->getMock(); - $this->store2 = $this->getMockBuilder([PersistStoreInterface::class, BlockingStoreInterface::class])->getMock(); + $this->store1 = $this->getMockBuilder([PersistingStoreInterface::class, BlockingStoreInterface::class])->getMock(); + $this->store2 = $this->getMockBuilder([PersistingStoreInterface::class, BlockingStoreInterface::class])->getMock(); $this->store = new CombinedStore([$this->store1, $this->store2], $this->strategy); } @@ -267,8 +267,8 @@ class CombinedStoreTest extends AbstractStoreTest public function testPutOffExpirationIgnoreNonExpiringStorage() { - $store1 = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); - $store2 = $this->getMockBuilder(PersistStoreInterface::class)->getMock(); + $store1 = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $store2 = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); $store = new CombinedStore([$store1, $store2], $this->strategy);