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

Commitdc231d0

Browse files
feature#41353 [Cache] Removed depreacted code (malteschlueter)
This PR was merged into the 6.0 branch.Discussion----------[Cache] Removed depreacted code| Q | A| ------------- | ---| Branch? | 6.0| Bug fix? | no| New feature? | no| Deprecations? | yes| Tickets | -| License | MIT| Doc PR | -This remove deprecated code from Cache.Is it necessary for the Changelog or Upgrade.md that the classes are not configurable anymore?Commits-------33a095d [Cache] Removed depreacted code
2 parents5013785 +33a095d commitdc231d0

File tree

4 files changed

+23
-89
lines changed

4 files changed

+23
-89
lines changed

‎src/Symfony/Component/Cache/DependencyInjection/CacheCollectorPass.php‎

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,16 @@
2626
*/
2727
class CacheCollectorPassimplements CompilerPassInterface
2828
{
29-
private$dataCollectorCacheId;
30-
private$cachePoolTag;
31-
private$cachePoolRecorderInnerSuffix;
32-
33-
publicfunction__construct(string$dataCollectorCacheId ='data_collector.cache',string$cachePoolTag ='cache.pool',string$cachePoolRecorderInnerSuffix ='.recorder_inner')
34-
{
35-
if (0 <\func_num_args()) {
36-
trigger_deprecation('symfony/cache','5.3','Configuring "%s" is deprecated.',__CLASS__);
37-
}
38-
39-
$this->dataCollectorCacheId =$dataCollectorCacheId;
40-
$this->cachePoolTag =$cachePoolTag;
41-
$this->cachePoolRecorderInnerSuffix =$cachePoolRecorderInnerSuffix;
42-
}
43-
4429
/**
4530
* {@inheritdoc}
4631
*/
4732
publicfunctionprocess(ContainerBuilder$container)
4833
{
49-
if (!$container->hasDefinition($this->dataCollectorCacheId)) {
34+
if (!$container->hasDefinition('data_collector.cache')) {
5035
return;
5136
}
5237

53-
foreach ($container->findTaggedServiceIds($this->cachePoolTag)as$id =>$attributes) {
38+
foreach ($container->findTaggedServiceIds('cache.pool')as$id =>$attributes) {
5439
$poolName =$attributes[0]['name'] ??$id;
5540

5641
$this->addToCollector($id,$poolName,$container);
@@ -64,13 +49,13 @@ private function addToCollector(string $id, string $name, ContainerBuilder $cont
6449
return;
6550
}
6651

67-
$collectorDefinition =$container->getDefinition($this->dataCollectorCacheId);
52+
$collectorDefinition =$container->getDefinition('data_collector.cache');
6853
$recorder =newDefinition(is_subclass_of($definition->getClass(), TagAwareAdapterInterface::class) ? TraceableTagAwareAdapter::class : TraceableAdapter::class);
6954
$recorder->setTags($definition->getTags());
7055
if (!$definition->isPublic() || !$definition->isPrivate()) {
7156
$recorder->setPublic($definition->isPublic());
7257
}
73-
$recorder->setArguments([newReference($innerId =$id.$this->cachePoolRecorderInnerSuffix)]);
58+
$recorder->setArguments([newReference($innerId =$id.'.recorder_inner')]);
7459

7560
$definition->setTags([]);
7661
$definition->setPublic(false);

‎src/Symfony/Component/Cache/DependencyInjection/CachePoolClearerPass.php‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,14 @@
2020
*/
2121
class CachePoolClearerPassimplements CompilerPassInterface
2222
{
23-
private$cachePoolClearerTag;
24-
25-
publicfunction__construct(string$cachePoolClearerTag ='cache.pool.clearer')
26-
{
27-
if (0 <\func_num_args()) {
28-
trigger_deprecation('symfony/cache','5.3','Configuring "%s" is deprecated.',__CLASS__);
29-
}
30-
31-
$this->cachePoolClearerTag =$cachePoolClearerTag;
32-
}
33-
3423
/**
3524
* {@inheritdoc}
3625
*/
3726
publicfunctionprocess(ContainerBuilder$container)
3827
{
3928
$container->getParameterBag()->remove('cache.prefix.seed');
4029

41-
foreach ($container->findTaggedServiceIds($this->cachePoolClearerTag)as$id =>$attr) {
30+
foreach ($container->findTaggedServiceIds('cache.pool.clearer')as$id =>$attr) {
4231
$clearer =$container->getDefinition($id);
4332
$pools = [];
4433
foreach ($clearer->getArgument(0)as$name =>$ref) {

‎src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php‎

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,6 @@
2828
*/
2929
class CachePoolPassimplements CompilerPassInterface
3030
{
31-
private$cachePoolTag;
32-
private$kernelResetTag;
33-
private$cacheClearerId;
34-
private$cachePoolClearerTag;
35-
private$cacheSystemClearerId;
36-
private$cacheSystemClearerTag;
37-
private$reverseContainerId;
38-
private$reversibleTag;
39-
private$messageHandlerId;
40-
41-
publicfunction__construct(string$cachePoolTag ='cache.pool',string$kernelResetTag ='kernel.reset',string$cacheClearerId ='cache.global_clearer',string$cachePoolClearerTag ='cache.pool.clearer',string$cacheSystemClearerId ='cache.system_clearer',string$cacheSystemClearerTag ='kernel.cache_clearer',string$reverseContainerId ='reverse_container',string$reversibleTag ='container.reversible',string$messageHandlerId ='cache.early_expiration_handler')
42-
{
43-
if (0 <\func_num_args()) {
44-
trigger_deprecation('symfony/cache','5.3','Configuring "%s" is deprecated.',__CLASS__);
45-
}
46-
47-
$this->cachePoolTag =$cachePoolTag;
48-
$this->kernelResetTag =$kernelResetTag;
49-
$this->cacheClearerId =$cacheClearerId;
50-
$this->cachePoolClearerTag =$cachePoolClearerTag;
51-
$this->cacheSystemClearerId =$cacheSystemClearerId;
52-
$this->cacheSystemClearerTag =$cacheSystemClearerTag;
53-
$this->reverseContainerId =$reverseContainerId;
54-
$this->reversibleTag =$reversibleTag;
55-
$this->messageHandlerId =$messageHandlerId;
56-
}
57-
5831
/**
5932
* {@inheritdoc}
6033
*/
@@ -78,7 +51,7 @@ public function process(ContainerBuilder $container)
7851
'early_expiration_message_bus',
7952
'reset',
8053
];
81-
foreach ($container->findTaggedServiceIds($this->cachePoolTag)as$id =>$tags) {
54+
foreach ($container->findTaggedServiceIds('cache.pool')as$id =>$tags) {
8255
$adapter =$pool =$container->getDefinition($id);
8356
if ($pool->isAbstract()) {
8457
continue;
@@ -87,7 +60,7 @@ public function process(ContainerBuilder $container)
8760
while ($adapterinstanceof ChildDefinition) {
8861
$adapter =$container->findDefinition($adapter->getParent());
8962
$class =$class ?:$adapter->getClass();
90-
if ($t =$adapter->getTag($this->cachePoolTag)) {
63+
if ($t =$adapter->getTag('cache.pool')) {
9164
$tags[0] +=$t[0];
9265
}
9366
}
@@ -129,7 +102,7 @@ public function process(ContainerBuilder $container)
129102
while ($adapterinstanceof ChildDefinition) {
130103
$adapter =$container->findDefinition($adapter->getParent());
131104
$chainedClass =$chainedClass ?:$adapter->getClass();
132-
if ($t =$adapter->getTag($this->cachePoolTag)) {
105+
if ($t =$adapter->getTag('cache.pool')) {
133106
$chainedTags[0] +=$t[0];
134107
}
135108
}
@@ -167,19 +140,19 @@ public function process(ContainerBuilder $container)
167140
// no-op
168141
}elseif ('reset' ===$attr) {
169142
if ($tags[0][$attr]) {
170-
$pool->addTag($this->kernelResetTag, ['method' =>$tags[0][$attr]]);
143+
$pool->addTag('kernel.reset', ['method' =>$tags[0][$attr]]);
171144
}
172145
}elseif ('early_expiration_message_bus' ===$attr) {
173146
$needsMessageHandler =true;
174147
$pool->addMethodCall('setCallbackWrapper', [(newDefinition(EarlyExpirationDispatcher::class))
175148
->addArgument(newReference($tags[0]['early_expiration_message_bus']))
176-
->addArgument(newReference($this->reverseContainerId))
149+
->addArgument(newReference('reverse_container'))
177150
->addArgument((newDefinition('callable'))
178151
->setFactory([newReference($id),'setCallbackWrapper'])
179152
->addArgument(null)
180153
),
181154
]);
182-
$pool->addTag($this->reversibleTag);
155+
$pool->addTag('container.reversible');
183156
}elseif ('namespace' !==$attr || ArrayAdapter::class !==$class) {
184157
$argument =$tags[0][$attr];
185158

@@ -193,7 +166,7 @@ public function process(ContainerBuilder $container)
193166
unset($tags[0][$attr]);
194167
}
195168
if (!empty($tags[0])) {
196-
thrownewInvalidArgumentException(sprintf('Invalid "%s" tag for service "%s": accepted attributes are "clearer", "provider", "name", "namespace", "default_lifetime", "early_expiration_message_bus" and "reset", found "%s".',$this->cachePoolTag,$id,implode('", "',array_keys($tags[0]))));
169+
thrownewInvalidArgumentException(sprintf('Invalid "cache.pool" tag for service "%s": accepted attributes are "clearer", "provider", "name", "namespace", "default_lifetime", "early_expiration_message_bus" and "reset", found "%s".',$id,implode('", "',array_keys($tags[0]))));
197170
}
198171

199172
if (null !==$clearer) {
@@ -204,14 +177,14 @@ public function process(ContainerBuilder $container)
204177
}
205178

206179
if (!$needsMessageHandler) {
207-
$container->removeDefinition($this->messageHandlerId);
180+
$container->removeDefinition('cache.early_expiration_handler');
208181
}
209182

210-
$notAliasedCacheClearerId =$this->cacheClearerId;
211-
while ($container->hasAlias($this->cacheClearerId)) {
212-
$this->cacheClearerId = (string)$container->getAlias($this->cacheClearerId);
183+
$notAliasedCacheClearerId =$aliasedCacheClearerId ='cache.global_clearer';
184+
while ($container->hasAlias('cache.global_clearer')) {
185+
$aliasedCacheClearerId = (string)$container->getAlias('cache.global_clearer');
213186
}
214-
if ($container->hasDefinition($this->cacheClearerId)) {
187+
if ($container->hasDefinition($aliasedCacheClearerId)) {
215188
$clearers[$notAliasedCacheClearerId] =$allPools;
216189
}
217190

@@ -222,10 +195,10 @@ public function process(ContainerBuilder $container)
222195
}else {
223196
$clearer->setArgument(0,$pools);
224197
}
225-
$clearer->addTag($this->cachePoolClearerTag);
198+
$clearer->addTag('cache.pool.clearer');
226199

227-
if ($this->cacheSystemClearerId ===$id) {
228-
$clearer->addTag($this->cacheSystemClearerTag);
200+
if ('cache.system_clearer' ===$id) {
201+
$clearer->addTag('kernel.cache_clearer');
229202
}
230203
}
231204

‎src/Symfony/Component/Cache/DependencyInjection/CachePoolPrunerPass.php‎

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,18 @@
2323
*/
2424
class CachePoolPrunerPassimplements CompilerPassInterface
2525
{
26-
private$cacheCommandServiceId;
27-
private$cachePoolTag;
28-
29-
publicfunction__construct(string$cacheCommandServiceId ='console.command.cache_pool_prune',string$cachePoolTag ='cache.pool')
30-
{
31-
if (0 <\func_num_args()) {
32-
trigger_deprecation('symfony/cache','5.3','Configuring "%s" is deprecated.',__CLASS__);
33-
}
34-
35-
$this->cacheCommandServiceId =$cacheCommandServiceId;
36-
$this->cachePoolTag =$cachePoolTag;
37-
}
38-
3926
/**
4027
* {@inheritdoc}
4128
*/
4229
publicfunctionprocess(ContainerBuilder$container)
4330
{
44-
if (!$container->hasDefinition($this->cacheCommandServiceId)) {
31+
if (!$container->hasDefinition('console.command.cache_pool_prune')) {
4532
return;
4633
}
4734

4835
$services = [];
4936

50-
foreach ($container->findTaggedServiceIds($this->cachePoolTag)as$id =>$tags) {
37+
foreach ($container->findTaggedServiceIds('cache.pool')as$id =>$tags) {
5138
$class =$container->getParameterBag()->resolveValue($container->getDefinition($id)->getClass());
5239

5340
if (!$reflection =$container->getReflectionClass($class)) {
@@ -59,6 +46,6 @@ public function process(ContainerBuilder $container)
5946
}
6047
}
6148

62-
$container->getDefinition($this->cacheCommandServiceId)->replaceArgument(0,newIteratorArgument($services));
49+
$container->getDefinition('console.command.cache_pool_prune')->replaceArgument(0,newIteratorArgument($services));
6350
}
6451
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp