Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b584fa

Browse files
committed
[Lock] remove Factory for LockFactory
1 parent8bfdd48 commit9b584fa

File tree

15 files changed

+42
-134
lines changed

15 files changed

+42
-134
lines changed

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,12 @@
6868
useSymfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
6969
useSymfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
7070
useSymfony\Component\HttpKernel\DependencyInjection\Extension;
71-
useSymfony\Component\Lock\Factory;
7271
useSymfony\Component\Lock\Lock;
7372
useSymfony\Component\Lock\LockFactory;
7473
useSymfony\Component\Lock\LockInterface;
7574
useSymfony\Component\Lock\PersistingStoreInterface;
7675
useSymfony\Component\Lock\Store\FlockStore;
7776
useSymfony\Component\Lock\Store\StoreFactory;
78-
useSymfony\Component\Lock\StoreInterface;
7977
useSymfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory;
8078
useSymfony\Component\Mailer\Bridge\Google\Transport\GmailTransportFactory;
8179
useSymfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillTransportFactory;
@@ -1499,15 +1497,11 @@ private function registerLockConfiguration(array $config, ContainerBuilder $cont
14991497
$container->setAlias('lock.store',newAlias('lock.'.$resourceName.'.store',false));
15001498
$container->setAlias('lock.factory',newAlias('lock.'.$resourceName.'.factory',false));
15011499
$container->setAlias('lock',newAlias('lock.'.$resourceName,false));
1502-
$container->setAlias(StoreInterface::class,newAlias('lock.store',false));
15031500
$container->setAlias(PersistingStoreInterface::class,newAlias('lock.store',false));
1504-
$container->setAlias(Factory::class,newAlias('lock.factory',false));
15051501
$container->setAlias(LockFactory::class,newAlias('lock.factory',false));
15061502
$container->setAlias(LockInterface::class,newAlias('lock',false));
15071503
}else {
1508-
$container->registerAliasForArgument('lock.'.$resourceName.'.store', StoreInterface::class,$resourceName.'.lock.store');
15091504
$container->registerAliasForArgument('lock.'.$resourceName.'.store', PersistingStoreInterface::class,$resourceName.'.lock.store');
1510-
$container->registerAliasForArgument('lock.'.$resourceName.'.factory', Factory::class,$resourceName.'.lock.factory');
15111505
$container->registerAliasForArgument('lock.'.$resourceName.'.factory', LockFactory::class,$resourceName.'.lock.factory');
15121506
$container->registerAliasForArgument('lock.'.$resourceName, LockInterface::class,$resourceName.'.lock');
15131507
}

‎src/Symfony/Component/Lock/CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
5.0.0
5+
-----
6+
7+
*`Factory` has been removed, use`LockFactory` instead.
8+
*`StoreInterface` has been removed, use`BlockingStoreInterface` and`PersistingStoreInterface` instead.
9+
410
4.4.0
511
-----
612

‎src/Symfony/Component/Lock/Factory.php‎

Lines changed: 0 additions & 54 deletions
This file was deleted.

‎src/Symfony/Component/Lock/LockFactory.php‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,41 @@
1111

1212
namespaceSymfony\Component\Lock;
1313

14+
usePsr\Log\LoggerAwareInterface;
15+
usePsr\Log\LoggerAwareTrait;
16+
usePsr\Log\NullLogger;
17+
1418
/**
1519
* Factory provides method to create locks.
1620
*
1721
* @author Jérémy Derussé <jeremy@derusse.com>
1822
* @author Hamza Amrouche <hamza.simperfit@gmail.com>
1923
*/
20-
class LockFactoryextends Factory
24+
class LockFactoryimplements LoggerAwareInterface
2125
{
26+
use LoggerAwareTrait;
27+
28+
private$store;
29+
30+
publicfunction__construct(PersistingStoreInterface$store)
31+
{
32+
$this->store =$store;
33+
34+
$this->logger =newNullLogger();
35+
}
36+
2237
/**
2338
* Creates a lock for the given resource.
2439
*
2540
* @param string $resource The resource to lock
2641
* @param float|null $ttl Maximum expected lock duration in seconds
2742
* @param bool $autoRelease Whether to automatically release the lock or not when the lock instance is destroyed
2843
*/
29-
publicfunctioncreateLock($resource,$ttl =300.0,$autoRelease =true):Lock
44+
publicfunctioncreateLock(string$resource,?float$ttl =300.0,bool$autoRelease =true):Lock
3045
{
31-
returnparent::createLock($resource,$ttl,$autoRelease);
46+
$lock =newLock(newKey($resource),$this->store,$ttl,$autoRelease);
47+
$lock->setLogger($this->logger);
48+
49+
return$lock;
3250
}
3351
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@
1919
useSymfony\Component\Lock\Exception\NotSupportedException;
2020
useSymfony\Component\Lock\Key;
2121
useSymfony\Component\Lock\PersistingStoreInterface;
22-
useSymfony\Component\Lock\StoreInterface;
2322
useSymfony\Component\Lock\Strategy\StrategyInterface;
2423

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
useSymfony\Component\Lock\Exception\LockConflictedException;
1717
useSymfony\Component\Lock\Exception\LockStorageException;
1818
useSymfony\Component\Lock\Key;
19-
useSymfony\Component\Lock\StoreInterface;
19+
useSymfony\Component\Lock\PersistingStoreInterface;
2020

2121
/**
2222
* FlockStore is a PersistingStoreInterface implementation using the FileSystem flock.
@@ -28,7 +28,7 @@
2828
* @author Romain Neutron <imprec@gmail.com>
2929
* @author Nicolas Grekas <p@tchwork.com>
3030
*/
31-
class FlockStoreimplementsStoreInterface, BlockingStoreInterface
31+
class FlockStoreimplementsPersistingStoreInterface, BlockingStoreInterface
3232
{
3333
private$lockPath;
3434

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

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

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
useSymfony\Component\Lock\Exception\LockConflictedException;
2020
useSymfony\Component\Lock\Exception\NotSupportedException;
2121
useSymfony\Component\Lock\Key;
22-
useSymfony\Component\Lock\StoreInterface;
22+
useSymfony\Component\Lock\PersistingStoreInterface;
2323

2424
/**
2525
* PdoStore is a PersistingStoreInterface implementation using a PDO connection.
@@ -34,7 +34,7 @@
3434
*
3535
* @author Jérémy Derussé <jeremy@derusse.com>
3636
*/
37-
class PdoStoreimplementsStoreInterface
37+
class PdoStoreimplementsPersistingStoreInterface
3838
{
3939
use ExpiringStoreTrait;
4040

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

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

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

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@
1818
useSymfony\Component\Lock\Exception\LockConflictedException;
1919
useSymfony\Component\Lock\Key;
2020
useSymfony\Component\Lock\PersistingStoreInterface;
21-
useSymfony\Component\Lock\StoreInterface;
2221

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp