Skip to content

Commit

Permalink
feature #31821 [FrameworkBundle][TwigBundle] Add missing deprecations…
Browse files Browse the repository at this point in the history
… 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 #21035 and 7169f4d

Commits
-------

61613d0 Add missing deprecations for PHP templating layer
  • Loading branch information
fabpot committed Jun 3, 2019
2 parents 693cbff + 61613d0 commit 061f622
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions UPGRADE-4.4.md
Expand Up @@ -31,6 +31,11 @@ Messenger
* Deprecated passing a `ContainerInterface` instance as first argument of the `ConsumeMessagesCommand` constructor,
pass a `RoutableMessageBus` instance instead.

FrameworkBundle
---------------

* Deprecated support for `templating` engine in `TemplateController`, use Twig instead

MonologBridge
--------------

Expand Down
1 change: 1 addition & 0 deletions UPGRADE-5.0.md
Expand Up @@ -219,6 +219,7 @@ FrameworkBundle
* Removed support for legacy translations directories `src/Resources/translations/` and `src/Resources/<BundleName>/translations/`, use `translations/` instead.
* Support for the legacy directory structure in `translation:update` and `debug:translation` commands has been removed.
* Removed the "Psr\SimpleCache\CacheInterface" / "cache.app.simple" service, use "Symfony\Contracts\Cache\CacheInterface" / "cache.app" instead.
* Removed support for `templating` engine in `TemplateController`, use Twig instead

HttpFoundation
--------------
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
@@ -1,6 +1,11 @@
CHANGELOG
=========

4.4.0
-----

* Deprecated support for `templating` engine in `TemplateController`, use Twig instead

4.3.0
-----

Expand Down
Expand Up @@ -29,6 +29,10 @@ class TemplateController

public function __construct(Environment $twig = null, EngineInterface $templating = null)
{
if (null !== $templating) {
@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);
}

$this->twig = $twig;
$this->templating = $templating;
}
Expand Down
Expand Up @@ -31,6 +31,9 @@ public function testTwig()
$this->assertEquals('bar', $controller('mytemplate')->getContent());
}

/**
* @group legacy
*/
public function testTemplating()
{
$templating = $this->getMockBuilder(EngineInterface::class)->getMock();
Expand Down
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Bundle\TwigBundle\CacheWarmer;

@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);

use Psr\Container\ContainerInterface;
use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface;
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
Expand All @@ -26,6 +28,8 @@
* as the Twig loader will need the cache generated by it.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since version 4.4, to be removed in 5.0; use Twig instead.
*/
class TemplateCacheCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface
{
Expand Down
Expand Up @@ -105,6 +105,7 @@ public function process(ContainerBuilder $container)
} else {
$container->setAlias('twig.loader.filesystem', new Alias('twig.loader.native_filesystem', false));
$container->removeDefinition('templating.engine.twig');
$container->removeDefinition('twig.cache_warmer');
}

if ($container->has('assets.packages')) {
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/TwigBundle/Resources/config/templating.xml
Expand Up @@ -17,6 +17,8 @@
<argument type="service" id="twig" />
<argument type="service" id="templating.name_parser" />
<argument type="service" id="templating.locator" />

<deprecated>The "%service_id%" service is deprecated since Symfony 4.4 and will be removed in 5.0.</deprecated>
</service>
</services>
</container>
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
Expand Up @@ -35,6 +35,8 @@
<argument type="service" id="Psr\Container\ContainerInterface" />
<argument type="service" id="templating.finder" on-invalid="ignore" />
<argument type="collection" /> <!-- Twig paths -->

<deprecated>The "%service_id%" service is deprecated since Symfony 4.4 and will be removed in 5.0.</deprecated>
</service>

<service id="twig.template_iterator" class="Symfony\Bundle\TwigBundle\TemplateIterator">
Expand Down
Expand Up @@ -52,6 +52,8 @@ public function __construct($templating = null, UriSigner $signer = null, string
* @param EngineInterface|Environment|null $templating An EngineInterface or an Environment instance
*
* @throws \InvalidArgumentException
*
* @internal
*/
public function setTemplating($templating)
{
Expand Down

0 comments on commit 061f622

Please sign in to comment.