Add missing deprecations for PHP templating layer

This commit is contained in:
Yonel Ceruto 2019-06-03 10:56:39 -04:00
parent c8f3cef35c
commit 61613d0bf0
10 changed files with 29 additions and 0 deletions

View File

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

View File

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

View File

@ -1,6 +1,11 @@
CHANGELOG
=========
4.4.0
-----
* Deprecated support for `templating` engine in `TemplateController`, use Twig instead
4.3.0
-----

View File

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

View File

@ -31,6 +31,9 @@ class TemplateControllerTest extends TestCase
$this->assertEquals('bar', $controller('mytemplate')->getContent());
}
/**
* @group legacy
*/
public function testTemplating()
{
$templating = $this->getMockBuilder(EngineInterface::class)->getMock();

View File

@ -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;
@ -26,6 +28,8 @@ use Twig\Error\Error;
* 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
{

View File

@ -105,6 +105,7 @@ class ExtensionPass implements CompilerPassInterface
} 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')) {

View File

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

View File

@ -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">

View File

@ -52,6 +52,8 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
* @param EngineInterface|Environment|null $templating An EngineInterface or an Environment instance
*
* @throws \InvalidArgumentException
*
* @internal
*/
public function setTemplating($templating)
{