Skip to content

Commit 25f1804

Browse files
committed
minor #32562 [Lock] remove usage of the StoreInterface (Simperfit)
This PR was merged into the 4.4 branch. Discussion ---------- [Lock] remove usage of the StoreInterface | Q | A | ------------- | --- | Branch? |4.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | none <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/roadmap): - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against branch 4.4. - Legacy code removals go to the master branch. --> Followup PR according to the review of @nicolas-grekas in #32555 (comment). Commits ------- 9988844 [Lock] remove uusage of the StoreInterface
2 parents e5ad989 + 9988844 commit 25f1804

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,7 @@ private function registerLockConfiguration(array $config, ContainerBuilder $cont
16061606
$container->setDefinition($connectionDefinitionId, $connectionDefinition);
16071607
}
16081608

1609-
$storeDefinition = new Definition(StoreInterface::class);
1609+
$storeDefinition = new Definition(PersistStoreInterface::class);
16101610
$storeDefinition->setPublic(false);
16111611
$storeDefinition->setFactory([StoreFactory::class, 'createStore']);
16121612
$storeDefinition->setArguments([new Reference($connectionDefinitionId)]);

src/Symfony/Component/Lock/Tests/LockTest.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Symfony\Component\Lock\Key;
1919
use Symfony\Component\Lock\Lock;
2020
use Symfony\Component\Lock\PersistStoreInterface;
21-
use Symfony\Component\Lock\StoreInterface;
2221

2322
/**
2423
* @author Jérémy Derussé <jeremy@derusse.com>
@@ -41,7 +40,7 @@ public function testAcquireNoBlocking()
4140
public function testAcquireNoBlockingStoreInterface()
4241
{
4342
$key = new Key(uniqid(__METHOD__, true));
44-
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
43+
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
4544
$lock = new Lock($key, $store);
4645

4746
$store
@@ -59,7 +58,7 @@ public function testAcquireNoBlockingStoreInterface()
5958
public function testPassingOldStoreInterface()
6059
{
6160
$key = new Key(uniqid(__METHOD__, true));
62-
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
61+
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
6362
$lock = new Lock($key, $store);
6463

6564
$store
@@ -86,7 +85,7 @@ public function testAcquireReturnsFalse()
8685
public function testAcquireReturnsFalseStoreInterface()
8786
{
8887
$key = new Key(uniqid(__METHOD__, true));
89-
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
88+
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
9089
$lock = new Lock($key, $store);
9190

9291
$store
@@ -121,7 +120,7 @@ public function testAcquireBlocking()
121120
public function testAcquireSetsTtl()
122121
{
123122
$key = new Key(uniqid(__METHOD__, true));
124-
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
123+
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
125124
$lock = new Lock($key, $store, 10);
126125

127126
$store
@@ -138,7 +137,7 @@ public function testAcquireSetsTtl()
138137
public function testRefresh()
139138
{
140139
$key = new Key(uniqid(__METHOD__, true));
141-
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
140+
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
142141
$lock = new Lock($key, $store, 10);
143142

144143
$store
@@ -152,7 +151,7 @@ public function testRefresh()
152151
public function testRefreshCustom()
153152
{
154153
$key = new Key(uniqid(__METHOD__, true));
155-
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
154+
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
156155
$lock = new Lock($key, $store, 10);
157156

158157
$store
@@ -201,7 +200,7 @@ public function testRelease()
201200
public function testReleaseStoreInterface()
202201
{
203202
$key = new Key(uniqid(__METHOD__, true));
204-
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
203+
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
205204
$lock = new Lock($key, $store, 10);
206205

207206
$store
@@ -356,7 +355,7 @@ public function testExpiration($ttls, $expected)
356355
public function testExpirationStoreInterface($ttls, $expected)
357356
{
358357
$key = new Key(uniqid(__METHOD__, true));
359-
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
358+
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
360359
$lock = new Lock($key, $store, 10);
361360

362361
foreach ($ttls as $ttl) {

src/Symfony/Component/Lock/Tests/Store/AbstractStoreTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Lock\Exception\LockConflictedException;
1616
use Symfony\Component\Lock\Key;
17-
use Symfony\Component\Lock\StoreInterface;
17+
use Symfony\Component\Lock\PersistStoreInterface;
1818

1919
/**
2020
* @author Jérémy Derussé <jeremy@derusse.com>
2121
*/
2222
abstract class AbstractStoreTest extends TestCase
2323
{
2424
/**
25-
* @return StoreInterface
25+
* @return PersistStoreInterface
2626
*/
2727
abstract protected function getStore();
2828

src/Symfony/Component/Lock/Tests/Store/BlockingStoreTestTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Symfony\Component\Lock\Exception\LockConflictedException;
1515
use Symfony\Component\Lock\Exception\NotSupportedException;
1616
use Symfony\Component\Lock\Key;
17-
use Symfony\Component\Lock\StoreInterface;
17+
use Symfony\Component\Lock\PersistStoreInterface;
1818

1919
/**
2020
* @author Jérémy Derussé <jeremy@derusse.com>
@@ -24,7 +24,7 @@ trait BlockingStoreTestTrait
2424
/**
2525
* @see AbstractStoreTest::getStore()
2626
*
27-
* @return StoreInterface
27+
* @return PersistStoreInterface
2828
*/
2929
abstract protected function getStore();
3030

src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Symfony\Component\Lock\PersistStoreInterface;
1818
use Symfony\Component\Lock\Store\CombinedStore;
1919
use Symfony\Component\Lock\Store\RedisStore;
20-
use Symfony\Component\Lock\StoreInterface;
2120
use Symfony\Component\Lock\Strategy\StrategyInterface;
2221
use Symfony\Component\Lock\Strategy\UnanimousStrategy;
2322

@@ -268,8 +267,8 @@ public function testputOffExpirationAbortWhenStrategyCantBeMet()
268267

269268
public function testPutOffExpirationIgnoreNonExpiringStorage()
270269
{
271-
$store1 = $this->getMockBuilder(StoreInterface::class)->getMock();
272-
$store2 = $this->getMockBuilder(StoreInterface::class)->getMock();
270+
$store1 = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
271+
$store2 = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
273272

274273
$store = new CombinedStore([$store1, $store2], $this->strategy);
275274

0 commit comments

Comments
 (0)