Skip to content

Commit 6f50bf4

Browse files
committed
feature #22620 [FrameworkBundle][HttpKernel] Move httpkernel pass (lepiaf)
This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle][HttpKernel] Move httpkernel pass | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | part of #21284 | License | MIT | Doc PR | n/a Move addcachearmer, addcacheclearer compiler pass to httpkernel Commits ------- 83727c7e3d [FrameworkBundle][HttpKernel] Move addcachearmer, addcacheclearer compiler pass
2 parents 4442c70 + bef1593 commit 6f50bf4

File tree

6 files changed

+21
-46
lines changed

6 files changed

+21
-46
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ CHANGELOG
1010
require symfony/stopwatch` in your `dev` environment.
1111
* Deprecated using the `KERNEL_DIR` environment variable with `KernelTestCase::getKernelClass()`.
1212
* Deprecated the `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()` methods.
13+
* Deprecated `AddCacheClearerPass`, use `Symfony\Component\HttpKernel\DependencyInjection\AddCacheClearerPass` instead.
14+
* Deprecated `AddCacheWarmerPass`, use `Symfony\Component\HttpKernel\DependencyInjection\AddCacheWarmerPass` instead.
1315

1416
3.3.0
1517
-----

DependencyInjection/Compiler/AddCacheClearerPass.php

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,17 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14-
use Symfony\Component\DependencyInjection\ContainerBuilder;
15-
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16-
use Symfony\Component\DependencyInjection\Reference;
14+
@trigger_error(sprintf('The %s class is deprecated since version 3.4 and will be removed in 4.0. Use Symfony\Component\HttpKernel\DependencyInjection\AddCacheClearerPass instead.', AddCacheClearerPass::class), E_USER_DEPRECATED);
15+
16+
use Symfony\Component\HttpKernel\DependencyInjection\AddCacheClearerPass as BaseAddCacheClearerPass;
1717

1818
/**
1919
* Registers the cache clearers.
2020
*
21+
* @deprecated since version 3.4, to be removed in 4.0. Use {@link BaseAddCacheClearerPass instead}.
22+
*
2123
* @author Dustin Dobervich <[email protected]>
2224
*/
23-
class AddCacheClearerPass implements CompilerPassInterface
25+
class AddCacheClearerPass extends BaseAddCacheClearerPass
2426
{
25-
/**
26-
* {@inheritdoc}
27-
*/
28-
public function process(ContainerBuilder $container)
29-
{
30-
if (!$container->hasDefinition('cache_clearer')) {
31-
return;
32-
}
33-
34-
$clearers = array();
35-
foreach ($container->findTaggedServiceIds('kernel.cache_clearer', true) as $id => $attributes) {
36-
$clearers[] = new Reference($id);
37-
}
38-
39-
$container->getDefinition('cache_clearer')->replaceArgument(0, $clearers);
40-
}
4127
}

DependencyInjection/Compiler/AddCacheWarmerPass.php

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,17 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14-
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
15-
use Symfony\Component\DependencyInjection\ContainerBuilder;
16-
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
14+
@trigger_error(sprintf('The %s class is deprecated since version 3.4 and will be removed in 4.0. Use Symfony\Component\HttpKernel\DependencyInjection\AddCacheWarmerPass instead.', AddCacheWarmerPass::class), E_USER_DEPRECATED);
15+
16+
use Symfony\Component\HttpKernel\DependencyInjection\AddCacheWarmerPass as BaseAddCacheWarmerPass;
1717

1818
/**
1919
* Registers the cache warmers.
2020
*
21+
* @deprecated since version 3.4, to be removed in 4.0. Use {@link BaseAddCacheWarmerPass instead}.
22+
*
2123
* @author Fabien Potencier <[email protected]>
2224
*/
23-
class AddCacheWarmerPass implements CompilerPassInterface
25+
class AddCacheWarmerPass extends BaseAddCacheWarmerPass
2426
{
25-
use PriorityTaggedServiceTrait;
26-
27-
/**
28-
* {@inheritdoc}
29-
*/
30-
public function process(ContainerBuilder $container)
31-
{
32-
if (!$container->hasDefinition('cache_warmer')) {
33-
return;
34-
}
35-
36-
$warmers = $this->findAndSortTaggedServices('kernel.cache_warmer', $container);
37-
38-
if (empty($warmers)) {
39-
return;
40-
}
41-
42-
$container->getDefinition('cache_warmer')->replaceArgument(0, $warmers);
43-
}
4427
}

FrameworkBundle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ProfilerPass;
2222
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslatorPass;
2323
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\LoggingTranslatorPass;
24-
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass;
25-
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheClearerPass;
2624
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddExpressionLanguageProvidersPass;
2725
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ContainerBuilderDebugDumpPass;
2826
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationExtractorPass;
2927
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationDumperPass;
3028
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\UnusedTagsPass;
3129
use Symfony\Component\Config\DependencyInjection\ConfigCachePass;
3230
use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass;
31+
use Symfony\Component\HttpKernel\DependencyInjection\AddCacheClearerPass;
32+
use Symfony\Component\HttpKernel\DependencyInjection\AddCacheWarmerPass;
3333
use Symfony\Component\HttpKernel\DependencyInjection\ControllerArgumentValueResolverPass;
3434
use Symfony\Component\HttpKernel\DependencyInjection\RegisterControllerArgumentLocatorsPass;
3535
use Symfony\Component\HttpKernel\DependencyInjection\RemoveEmptyControllerArgumentLocatorsPass;

Tests/DependencyInjection/Compiler/AddCacheWarmerPassTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use Symfony\Component\DependencyInjection\Reference;
1717
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass;
1818

19+
/**
20+
* @group legacy
21+
*/
1922
class AddCacheWarmerPassTest extends TestCase
2023
{
2124
public function testThatCacheWarmersAreProcessedInPriorityOrder()

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"symfony/config": "~3.3|~4.0",
2525
"symfony/event-dispatcher": "^3.3.1|~4.0",
2626
"symfony/http-foundation": "~3.3|~4.0",
27-
"symfony/http-kernel": "~3.3|~4.0",
27+
"symfony/http-kernel": "~3.4|~4.0",
2828
"symfony/polyfill-mbstring": "~1.0",
2929
"symfony/filesystem": "~2.8|~3.0|~4.0",
3030
"symfony/finder": "~2.8|~3.0|~4.0",
@@ -66,6 +66,7 @@
6666
"symfony/asset": "<3.3",
6767
"symfony/console": "<3.3",
6868
"symfony/form": "<3.3",
69+
"symfony/http-kernel": "<3.4",
6970
"symfony/property-info": "<3.3",
7071
"symfony/serializer": "<3.3",
7172
"symfony/translation": "<3.2",

0 commit comments

Comments
 (0)