Skip to content

[FrameworkBundle][TwigBundle] Add missing deprecations for PHP templating layer #31821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions UPGRADE-4.4.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

4.4.0
-----

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

4.3.0
-----

Expand Down
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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