Skip to content

Commit a37c0dc

Browse files
committed
[Lock] remove StoreInterface in favor off PersistStoreInterface
1 parent 7dee61c commit a37c0dc

21 files changed

+57
-94
lines changed

UPGRADE-5.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@ Intl
301301
* Removed `Intl::getLocaleBundle()`, use `Locales` instead
302302
* Removed `Intl::getRegionBundle()`, use `Countries` instead
303303

304+
Lock
305+
----
306+
307+
* Removed `Symfony\Component\Lock\StoreInterface` in favor of `Symfony\Component\Lock\BlockingStoreInterface` and `Symfony\Component\Lock\PersistStoreInterface`
308+
304309
Messenger
305310
---------
306311

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
use Symfony\Component\Lock\PersistStoreInterface;
7575
use Symfony\Component\Lock\Store\FlockStore;
7676
use Symfony\Component\Lock\Store\StoreFactory;
77-
use Symfony\Component\Lock\StoreInterface;
7877
use Symfony\Component\Mailer\Mailer;
7978
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
8079
use Symfony\Component\Messenger\MessageBus;
@@ -1441,7 +1440,7 @@ private function registerLockConfiguration(array $config, ContainerBuilder $cont
14411440
$container->setDefinition($connectionDefinitionId, $connectionDefinition);
14421441
}
14431442

1444-
$storeDefinition = new Definition(StoreInterface::class);
1443+
$storeDefinition = new Definition(PersistStoreInterface::class);
14451444
$storeDefinition->setPublic(false);
14461445
$storeDefinition->setFactory([StoreFactory::class, 'createStore']);
14471446
$storeDefinition->setArguments([new Reference($connectionDefinitionId)]);
@@ -1483,12 +1482,10 @@ private function registerLockConfiguration(array $config, ContainerBuilder $cont
14831482
$container->setAlias('lock.store', new Alias('lock.'.$resourceName.'.store', false));
14841483
$container->setAlias('lock.factory', new Alias('lock.'.$resourceName.'.factory', false));
14851484
$container->setAlias('lock', new Alias('lock.'.$resourceName, false));
1486-
$container->setAlias(StoreInterface::class, new Alias('lock.store', false));
14871485
$container->setAlias(PersistStoreInterface::class, new Alias('lock.store', false));
14881486
$container->setAlias(Factory::class, new Alias('lock.factory', false));
14891487
$container->setAlias(LockInterface::class, new Alias('lock', false));
14901488
} else {
1491-
$container->registerAliasForArgument('lock.'.$resourceName.'.store', StoreInterface::class, $resourceName.'.lock.store');
14921489
$container->registerAliasForArgument('lock.'.$resourceName.'.store', PersistStoreInterface::class, $resourceName.'.lock.store');
14931490
$container->registerAliasForArgument('lock.'.$resourceName.'.factory', Factory::class, $resourceName.'.lock.factory');
14941491
$container->registerAliasForArgument('lock.'.$resourceName, LockInterface::class, $resourceName.'.lock');

src/Symfony/Component/Lock/Factory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Factory implements LoggerAwareInterface
2828

2929
private $store;
3030

31-
public function __construct(StoreInterface $store)
31+
public function __construct(PersistStoreInterface $store)
3232
{
3333
$this->store = $store;
3434

src/Symfony/Component/Lock/Lock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function acquire($blocking = false): ?bool
7171
{
7272
try {
7373
if ($blocking) {
74-
if (!$this->store instanceof StoreInterface && !($this->store instanceof BlockingStoreInterface && $this->store->supportsWaitAndSave())) {
74+
if (!($this->store instanceof BlockingStoreInterface && $this->store->supportsWaitAndSave())) {
7575
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this->store)));
7676
}
7777
$this->store->waitAndSave($this->key);

src/Symfony/Component/Lock/Store/CombinedStore.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@
1919
use Symfony\Component\Lock\Exception\NotSupportedException;
2020
use Symfony\Component\Lock\Key;
2121
use Symfony\Component\Lock\PersistStoreInterface;
22-
use Symfony\Component\Lock\StoreInterface;
2322
use Symfony\Component\Lock\Strategy\StrategyInterface;
2423

2524
/**
26-
* CombinedStore is a StoreInterface implementation able to manage and synchronize several StoreInterfaces.
25+
* CombinedStore is a PersistStoreInterface implementation able to manage and synchronize several StoreInterfaces.
2726
*
2827
* @author Jérémy Derussé <jeremy@derusse.com>
2928
*/
30-
class CombinedStore implements StoreInterface, LoggerAwareInterface
29+
class CombinedStore implements PersistStoreInterface, LoggerAwareInterface
3130
{
3231
use LoggerAwareTrait;
3332
use ExpiringStoreTrait;

src/Symfony/Component/Lock/Store/FlockStore.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
use Symfony\Component\Lock\Exception\LockConflictedException;
1717
use Symfony\Component\Lock\Exception\LockStorageException;
1818
use Symfony\Component\Lock\Key;
19-
use Symfony\Component\Lock\StoreInterface;
19+
use Symfony\Component\Lock\PersistStoreInterface;
2020

2121
/**
22-
* FlockStore is a StoreInterface implementation using the FileSystem flock.
22+
* FlockStore is a PersistStoreInterface implementation using the FileSystem flock.
2323
*
2424
* Original implementation in \Symfony\Component\Filesystem\LockHandler.
2525
*
@@ -28,7 +28,7 @@
2828
* @author Romain Neutron <imprec@gmail.com>
2929
* @author Nicolas Grekas <p@tchwork.com>
3030
*/
31-
class FlockStore implements StoreInterface, BlockingStoreInterface
31+
class FlockStore implements PersistStoreInterface, BlockingStoreInterface
3232
{
3333
private $lockPath;
3434

src/Symfony/Component/Lock/Store/MemcachedStore.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
use Symfony\Component\Lock\Exception\InvalidTtlException;
1616
use Symfony\Component\Lock\Exception\LockConflictedException;
1717
use Symfony\Component\Lock\Key;
18-
use Symfony\Component\Lock\StoreInterface;
18+
use Symfony\Component\Lock\PersistStoreInterface;
1919

2020
/**
21-
* MemcachedStore is a StoreInterface implementation using Memcached as store engine.
21+
* MemcachedStore is a PersistStoreInterface implementation using Memcached as store engine.
2222
*
2323
* @author Jérémy Derussé <jeremy@derusse.com>
2424
*/
25-
class MemcachedStore implements StoreInterface
25+
class MemcachedStore implements PersistStoreInterface
2626
{
2727
use ExpiringStoreTrait;
2828

src/Symfony/Component/Lock/Store/PdoStore.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
use Symfony\Component\Lock\Exception\LockConflictedException;
2020
use Symfony\Component\Lock\Exception\NotSupportedException;
2121
use Symfony\Component\Lock\Key;
22-
use Symfony\Component\Lock\StoreInterface;
22+
use Symfony\Component\Lock\PersistStoreInterface;
2323

2424
/**
25-
* PdoStore is a StoreInterface implementation using a PDO connection.
25+
* PdoStore is a PersistStoreInterface implementation using a PDO connection.
2626
*
2727
* Lock metadata are stored in a table. You can use createTable() to initialize
2828
* a correctly defined table.
@@ -34,7 +34,7 @@
3434
*
3535
* @author Jérémy Derussé <jeremy@derusse.com>
3636
*/
37-
class PdoStore implements StoreInterface
37+
class PdoStore implements PersistStoreInterface
3838
{
3939
use ExpiringStoreTrait;
4040

src/Symfony/Component/Lock/Store/RedisStore.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
use Symfony\Component\Lock\Exception\InvalidTtlException;
1818
use Symfony\Component\Lock\Exception\LockConflictedException;
1919
use Symfony\Component\Lock\Key;
20-
use Symfony\Component\Lock\StoreInterface;
20+
use Symfony\Component\Lock\PersistStoreInterface;
2121

2222
/**
23-
* RedisStore is a StoreInterface implementation using Redis as store engine.
23+
* RedisStore is a PersistStoreInterface implementation using Redis as store engine.
2424
*
2525
* @author Jérémy Derussé <jeremy@derusse.com>
2626
*/
27-
class RedisStore implements StoreInterface
27+
class RedisStore implements PersistStoreInterface
2828
{
2929
use ExpiringStoreTrait;
3030

src/Symfony/Component/Lock/Store/RetryTillSaveStore.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@
1818
use Symfony\Component\Lock\Exception\LockConflictedException;
1919
use Symfony\Component\Lock\Key;
2020
use Symfony\Component\Lock\PersistStoreInterface;
21-
use Symfony\Component\Lock\StoreInterface;
2221

2322
/**
24-
* RetryTillSaveStore is a StoreInterface implementation which decorate a non blocking StoreInterface to provide a
23+
* RetryTillSaveStore is a PersistStoreInterface implementation which decorate a non blocking PersistStoreInterface to provide a
2524
* blocking storage.
2625
*
2726
* @author Jérémy Derussé <jeremy@derusse.com>
2827
*/
29-
class RetryTillSaveStore implements PersistStoreInterface, BlockingStoreInterface, StoreInterface, LoggerAwareInterface
28+
class RetryTillSaveStore implements PersistStoreInterface, BlockingStoreInterface, LoggerAwareInterface
3029
{
3130
use LoggerAwareTrait;
3231

@@ -35,7 +34,7 @@ class RetryTillSaveStore implements PersistStoreInterface, BlockingStoreInterfac
3534
private $retryCount;
3635

3736
/**
38-
* @param PersistStoreInterface $decorated The decorated StoreInterface
37+
* @param PersistStoreInterface $decorated The decorated PersistStoreInterface
3938
* @param int $retrySleep Duration in ms between 2 retry
4039
* @param int $retryCount Maximum amount of retry
4140
*/

0 commit comments

Comments
 (0)