Skip to content

Commit 76eef33

Browse files
committed
feature #31821 [FrameworkBundle][TwigBundle] Add missing deprecations for PHP templating layer (yceruto)
This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle][TwigBundle] Add missing deprecations for PHP templating layer | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - As part of symfony/symfony#21035 and symfony/symfony@7169f4d Commits ------- 61613d0bf0 Add missing deprecations for PHP templating layer
2 parents a27c842 + 72de479 commit 76eef33

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
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

Controller/TemplateController.php

Lines changed: 4 additions & 0 deletions
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
}

Tests/Controller/TemplateControllerTest.php

Lines changed: 3 additions & 0 deletions
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();

0 commit comments

Comments
 (0)