Skip to content

Commit b225f6e

Browse files
dunglasfabpot
authored andcommitted
[FrameworkBundle] Deprecate the Templating component integration
1 parent 6af235e commit b225f6e

File tree

67 files changed

+351
-73
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+351
-73
lines changed

CacheWarmer/TemplateFinder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\CacheWarmer;
1313

14+
@trigger_error('The '.TemplateFinder::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
15+
1416
use Symfony\Component\Finder\Finder;
1517
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
1618
use Symfony\Component\HttpKernel\KernelInterface;
@@ -21,6 +23,8 @@
2123
* Finds all the templates.
2224
*
2325
* @author Victor Berchet <[email protected]>
26+
*
27+
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
2428
*/
2529
class TemplateFinder implements TemplateFinderInterface
2630
{

CacheWarmer/TemplateFinderInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\CacheWarmer;
1313

14+
@trigger_error('The '.TemplateFinderInterface::class.' interface is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
15+
1416
/**
1517
* Interface for finding all the templates.
1618
*
1719
* @author Victor Berchet <[email protected]>
20+
*
21+
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
1822
*/
1923
interface TemplateFinderInterface
2024
{

CacheWarmer/TemplatePathsCacheWarmer.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\CacheWarmer;
1313

14+
@trigger_error('The '.TemplatePathsCacheWarmer::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
15+
1416
use Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator;
1517
use Symfony\Component\Filesystem\Filesystem;
1618
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmer;
@@ -19,6 +21,8 @@
1921
* Computes the association between template names and their paths on the disk.
2022
*
2123
* @author Fabien Potencier <[email protected]>
24+
*
25+
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
2226
*/
2327
class TemplatePathsCacheWarmer extends CacheWarmer
2428
{

Controller/ControllerTrait.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ protected function denyAccessUnlessGranted($attributes, $subject = null, string
206206
protected function renderView(string $view, array $parameters = []): string
207207
{
208208
if ($this->container->has('templating')) {
209+
@trigger_error('Using the "templating" service is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
210+
209211
return $this->container->get('templating')->render($view, $parameters);
210212
}
211213

@@ -224,6 +226,8 @@ protected function renderView(string $view, array $parameters = []): string
224226
protected function render(string $view, array $parameters = [], Response $response = null): Response
225227
{
226228
if ($this->container->has('templating')) {
229+
@trigger_error('Using the "templating" service is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
230+
227231
$content = $this->container->get('templating')->render($view, $parameters);
228232
} elseif ($this->container->has('twig')) {
229233
$content = $this->container->get('twig')->render($view, $parameters);
@@ -248,6 +252,8 @@ protected function render(string $view, array $parameters = [], Response $respon
248252
protected function stream(string $view, array $parameters = [], StreamedResponse $response = null): StreamedResponse
249253
{
250254
if ($this->container->has('templating')) {
255+
@trigger_error('Using the "templating" service is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
256+
251257
$templating = $this->container->get('templating');
252258

253259
$callback = function () use ($templating, $view, $parameters) {

DependencyInjection/Compiler/TemplatingPass.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
use Symfony\Component\DependencyInjection\Reference;
1919
use Symfony\Component\Templating\EngineInterface as ComponentEngineInterface;
2020

21+
/**
22+
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
23+
*/
2124
class TemplatingPass implements CompilerPassInterface
2225
{
2326
public function process(ContainerBuilder $container)
@@ -34,7 +37,12 @@ public function process(ContainerBuilder $container)
3437
if ($container->hasDefinition('templating.engine.php')) {
3538
$refs = [];
3639
$helpers = [];
40+
3741
foreach ($container->findTaggedServiceIds('templating.helper', true) as $id => $attributes) {
42+
if (!$container->getDefinition($id)->isDeprecated()) {
43+
@trigger_error('The "templating.helper" tag is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
44+
}
45+
3846
if (isset($attributes[0]['alias'])) {
3947
$helpers[$attributes[0]['alias']] = $id;
4048
$refs[$id] = new Reference($id);

DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ public function load(array $configs, ContainerBuilder $container)
264264
}
265265

266266
if ($this->isConfigEnabled($container, $config['templating'])) {
267+
@trigger_error('Enabling the Templating component is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
268+
267269
if (!class_exists('Symfony\Component\Templating\PhpEngine')) {
268270
throw new LogicException('Templating support cannot be enabled as the Templating component is not installed. Try running "composer require symfony/templating".');
269271
}

Resources/config/templating.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,56 @@
1010
<service id="templating.engine.delegating" class="Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine">
1111
<argument type="service" id="service_container" />
1212
<argument type="collection" /> <!-- engines -->
13+
14+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
1315
</service>
1416

1517
<service id="templating.name_parser" class="Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser">
1618
<argument type="service" id="kernel" />
19+
20+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
1721
</service>
1822

1923
<service id="templating.filename_parser" class="Symfony\Bundle\FrameworkBundle\Templating\TemplateFilenameParser" />
2024

2125
<service id="templating.locator" class="Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator">
2226
<argument type="service" id="file_locator" />
2327
<argument>%kernel.cache_dir%</argument>
28+
29+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
2430
</service>
2531

2632
<service id="templating.finder" class="Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinder">
2733
<argument type="service" id="kernel" />
2834
<argument type="service" id="templating.filename_parser" />
2935
<argument>%kernel.root_dir%/Resources</argument>
36+
37+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
3038
</service>
3139

3240
<service id="templating.cache_warmer.template_paths" class="Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplatePathsCacheWarmer">
3341
<tag name="kernel.cache_warmer" priority="20" />
3442
<argument type="service" id="templating.finder" />
3543
<argument type="service" id="templating.locator" />
44+
45+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
3646
</service>
3747

3848
<service id="templating.loader.filesystem" class="Symfony\Bundle\FrameworkBundle\Templating\Loader\FilesystemLoader">
3949
<argument type="service" id="templating.locator" />
50+
51+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
4052
</service>
4153

4254
<service id="templating.loader.cache" class="Symfony\Component\Templating\Loader\CacheLoader">
4355
<argument type="service" id="templating.loader.wrapped" />
4456
<argument>%templating.loader.cache.path%</argument>
57+
58+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
4559
</service>
4660

4761
<service id="templating.loader.chain" class="Symfony\Component\Templating\Loader\ChainLoader">
62+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
4863
</service>
4964

5065
<service id="templating.loader" alias="templating.loader.filesystem" public="true" />

Resources/config/templating_debug.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
<argument type="service" id="debug.stopwatch" />
1515
<argument type="service" id="templating.globals" />
1616
<call method="setCharset"><argument>%kernel.charset%</argument></call>
17+
18+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
1719
</service>
1820
</services>
1921
</container>

Resources/config/templating_php.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<argument type="service" id="templating.loader" />
1414
<argument type="service" id="templating.globals" />
1515
<call method="setCharset"><argument>%kernel.charset%</argument></call>
16+
17+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
1618
</service>
1719

1820
<service id="templating.engine.php.helpers_locator">
@@ -22,67 +24,93 @@
2224

2325
<service id="templating.helper.slots" class="Symfony\Component\Templating\Helper\SlotsHelper">
2426
<tag name="templating.helper" alias="slots" />
27+
28+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
2529
</service>
2630

2731
<service id="templating.helper.request" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\RequestHelper">
2832
<tag name="templating.helper" alias="request" />
2933
<argument type="service" id="request_stack" />
34+
35+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
3036
</service>
3137

3238
<service id="templating.helper.session" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\SessionHelper">
3339
<tag name="templating.helper" alias="session" />
3440
<argument type="service" id="request_stack" />
41+
42+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
3543
</service>
3644

3745
<service id="templating.helper.router" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\RouterHelper">
3846
<tag name="templating.helper" alias="router" />
3947
<argument type="service" id="router" />
48+
49+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
4050
</service>
4151

4252
<service id="templating.helper.assets" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\AssetsHelper">
4353
<tag name="templating.helper" alias="assets" />
4454
<argument /> <!-- packages -->
55+
56+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
4557
</service>
4658

4759
<service id="templating.helper.actions" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\ActionsHelper">
4860
<tag name="templating.helper" alias="actions" />
4961
<argument type="service" id="fragment.handler" />
62+
63+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
5064
</service>
5165

5266
<service id="templating.helper.code" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\CodeHelper">
5367
<tag name="templating.helper" alias="code" />
5468
<argument type="service" id="debug.file_link_formatter"></argument>
5569
<argument>%kernel.project_dir%</argument>
5670
<argument>%kernel.charset%</argument>
71+
72+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
5773
</service>
5874

5975
<service id="templating.helper.translator" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\TranslatorHelper">
6076
<tag name="templating.helper" alias="translator" />
6177
<argument type="service" id="translator" on-invalid="null" />
78+
79+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
6280
</service>
6381

6482
<service id="templating.helper.form" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper">
6583
<tag name="templating.helper" alias="form" />
6684
<argument type="service" id="templating.form.renderer" />
85+
86+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
6787
</service>
6888

6989
<service id="templating.helper.stopwatch" class="Symfony\Bundle\FrameworkBundle\Templating\Helper\StopwatchHelper">
7090
<tag name="templating.helper" alias="stopwatch" />
7191
<argument type="service" id="debug.stopwatch" on-invalid="ignore" />
92+
93+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
7294
</service>
7395

7496
<service id="templating.form.engine" class="Symfony\Component\Form\Extension\Templating\TemplatingRendererEngine">
7597
<argument type="service" id="templating.engine.php" />
7698
<argument>%templating.helper.form.resources%</argument>
99+
100+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
77101
</service>
78102

79103
<service id="templating.form.renderer" class="Symfony\Component\Form\FormRenderer">
80104
<argument type="service" id="templating.form.engine" />
81105
<argument type="service" id="security.csrf.token_manager" on-invalid="null" />
106+
107+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
82108
</service>
83109

84110
<service id="templating.globals" class="Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables">
85111
<argument type="service" id="service_container" />
112+
113+
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
86114
</service>
87115
</services>
88116
</container>

Templating/DelegatingEngine.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Templating;
1313

14+
@trigger_error('The '.DelegatingEngine::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
15+
1416
use Psr\Container\ContainerInterface;
1517
use Symfony\Component\HttpFoundation\Response;
1618
use Symfony\Component\Templating\DelegatingEngine as BaseDelegatingEngine;
@@ -19,6 +21,8 @@
1921
* DelegatingEngine selects an engine for a given template.
2022
*
2123
* @author Fabien Potencier <[email protected]>
24+
*
25+
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
2226
*/
2327
class DelegatingEngine extends BaseDelegatingEngine implements EngineInterface
2428
{

Templating/EngineInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Templating;
1313

14+
@trigger_error('The '.EngineInterface::class.' interface is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
15+
1416
use Symfony\Component\HttpFoundation\Response;
1517
use Symfony\Component\Templating\EngineInterface as BaseEngineInterface;
1618

1719
/**
1820
* EngineInterface is the interface each engine must implement.
1921
*
2022
* @author Fabien Potencier <[email protected]>
23+
*
24+
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
2125
*/
2226
interface EngineInterface extends BaseEngineInterface
2327
{

Templating/GlobalVariables.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Templating;
1313

14+
@trigger_error('The '.GlobalVariables::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
15+
1416
use Symfony\Component\DependencyInjection\ContainerInterface;
1517
use Symfony\Component\HttpFoundation\Request;
1618
use Symfony\Component\HttpFoundation\Session\Session;
@@ -20,6 +22,8 @@
2022
* GlobalVariables is the entry point for Symfony global variables in PHP templates.
2123
*
2224
* @author Fabien Potencier <[email protected]>
25+
*
26+
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
2327
*/
2428
class GlobalVariables
2529
{

Templating/Helper/ActionsHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Templating\Helper;
1313

14+
@trigger_error('The '.ActionsHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
15+
1416
use Symfony\Component\HttpKernel\Controller\ControllerReference;
1517
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
1618
use Symfony\Component\Templating\Helper\Helper;
@@ -19,6 +21,8 @@
1921
* ActionsHelper manages action inclusions.
2022
*
2123
* @author Fabien Potencier <[email protected]>
24+
*
25+
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
2226
*/
2327
class ActionsHelper extends Helper
2428
{

Templating/Helper/AssetsHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Templating\Helper;
1313

14+
@trigger_error('The '.AssetsHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
15+
1416
use Symfony\Component\Asset\Packages;
1517
use Symfony\Component\Templating\Helper\Helper;
1618

1719
/**
1820
* AssetsHelper helps manage asset URLs.
1921
*
2022
* @author Fabien Potencier <[email protected]>
23+
*
24+
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
2125
*/
2226
class AssetsHelper extends Helper
2327
{

Templating/Helper/CodeHelper.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Templating\Helper;
1313

14+
@trigger_error('The '.CodeHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
15+
1416
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
1517
use Symfony\Component\Templating\Helper\Helper;
1618

1719
/**
1820
* @author Fabien Potencier <[email protected]>
1921
*
20-
* @internal since Symfony 4.2, all properties will be private in 5.0
22+
* @internal since Symfony 4.2
23+
*
24+
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
2125
*/
2226
class CodeHelper extends Helper
2327
{

0 commit comments

Comments
 (0)