Skip to content

Commit 61613d0

Browse files
committed
Add missing deprecations for PHP templating layer
1 parent c8f3cef commit 61613d0

File tree

10 files changed

+29
-0
lines changed

10 files changed

+29
-0
lines changed

UPGRADE-4.4.md

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ Messenger
3131
* Deprecated passing a `ContainerInterface` instance as first argument of the `ConsumeMessagesCommand` constructor,
3232
pass a `RoutableMessageBus` instance instead.
3333

34+
FrameworkBundle
35+
---------------
36+
37+
* Deprecated support for `templating` engine in `TemplateController`, use Twig instead
38+
3439
MonologBridge
3540
--------------
3641

UPGRADE-5.0.md

+1
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ FrameworkBundle
219219
* Removed support for legacy translations directories `src/Resources/translations/` and `src/Resources/<BundleName>/translations/`, use `translations/` instead.
220220
* Support for the legacy directory structure in `translation:update` and `debug:translation` commands has been removed.
221221
* Removed the "Psr\SimpleCache\CacheInterface" / "cache.app.simple" service, use "Symfony\Contracts\Cache\CacheInterface" / "cache.app" instead.
222+
* Removed support for `templating` engine in `TemplateController`, use Twig instead
222223

223224
HttpFoundation
224225
--------------

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
4.4.0
5+
-----
6+
7+
* Deprecated support for `templating` engine in `TemplateController`, use Twig instead
8+
49
4.3.0
510
-----
611

src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class TemplateController
2929

3030
public function __construct(Environment $twig = null, EngineInterface $templating = null)
3131
{
32+
if (null !== $templating) {
33+
@trigger_error(sprintf('Using a "%s" instance for "%s" is deprecated since version 4.4; use a \Twig\Environment instance instead.', EngineInterface::class, __CLASS__), E_USER_DEPRECATED);
34+
}
35+
3236
$this->twig = $twig;
3337
$this->templating = $templating;
3438
}

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public function testTwig()
3131
$this->assertEquals('bar', $controller('mytemplate')->getContent());
3232
}
3333

34+
/**
35+
* @group legacy
36+
*/
3437
public function testTemplating()
3538
{
3639
$templating = $this->getMockBuilder(EngineInterface::class)->getMock();

src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Bundle\TwigBundle\CacheWarmer;
1313

14+
@trigger_error('The '.TemplateCacheCacheWarmer::class.' class is deprecated since version 4.4 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
15+
1416
use Psr\Container\ContainerInterface;
1517
use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface;
1618
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
@@ -26,6 +28,8 @@
2628
* as the Twig loader will need the cache generated by it.
2729
*
2830
* @author Fabien Potencier <fabien@symfony.com>
31+
*
32+
* @deprecated since version 4.4, to be removed in 5.0; use Twig instead.
2933
*/
3034
class TemplateCacheCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface
3135
{

src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public function process(ContainerBuilder $container)
105105
} else {
106106
$container->setAlias('twig.loader.filesystem', new Alias('twig.loader.native_filesystem', false));
107107
$container->removeDefinition('templating.engine.twig');
108+
$container->removeDefinition('twig.cache_warmer');
108109
}
109110

110111
if ($container->has('assets.packages')) {

src/Symfony/Bundle/TwigBundle/Resources/config/templating.xml

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<argument type="service" id="twig" />
1818
<argument type="service" id="templating.name_parser" />
1919
<argument type="service" id="templating.locator" />
20+
21+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.4 and will be removed in 5.0.</deprecated>
2022
</service>
2123
</services>
2224
</container>

src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
<argument type="service" id="Psr\Container\ContainerInterface" />
3636
<argument type="service" id="templating.finder" on-invalid="ignore" />
3737
<argument type="collection" /> <!-- Twig paths -->
38+
39+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.4 and will be removed in 5.0.</deprecated>
3840
</service>
3941

4042
<service id="twig.template_iterator" class="Symfony\Bundle\TwigBundle\TemplateIterator">

src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public function __construct($templating = null, UriSigner $signer = null, string
5252
* @param EngineInterface|Environment|null $templating An EngineInterface or an Environment instance
5353
*
5454
* @throws \InvalidArgumentException
55+
*
56+
* @internal
5557
*/
5658
public function setTemplating($templating)
5759
{

0 commit comments

Comments
 (0)