From b9c91cd88cf6dfd78fe874ba55c1e9333c83bef1 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Fri, 2 Jun 2017 15:07:31 +0200 Subject: [PATCH] Deprecate passing a concrete service in optional cache warmers --- .../FrameworkBundle/CacheWarmer/RouterCacheWarmer.php | 2 ++ .../CacheWarmer/TranslationsCacheWarmer.php | 5 +++-- .../Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php | 7 ++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php index 256bebebe80b7..a650960c948e2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php @@ -19,6 +19,8 @@ * Generates the router matcher and generator classes. * * @author Fabien Potencier + * + * @final since version 3.4, to be given a container instead in 4.0 */ class RouterCacheWarmer implements CacheWarmerInterface { diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php index 33f94650449fb..8a416a2925650 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php @@ -29,7 +29,7 @@ class TranslationsCacheWarmer implements CacheWarmerInterface /** * TranslationsCacheWarmer constructor. * - * @param ContainerInterface|TranslatorInterface $container + * @param ContainerInterface $container */ public function __construct($container) { @@ -38,8 +38,9 @@ public function __construct($container) $this->container = $container; } elseif ($container instanceof TranslatorInterface) { $this->translator = $container; + @trigger_error(sprintf('Using a "%s" as first argument of %s is deprecated since version 3.4 and will be unsupported in version 4.0. Use a %s instead.', TranslatorInterface::class, __CLASS__, ContainerInterface::class), E_USER_DEPRECATED); } else { - throw new \InvalidArgumentException(sprintf('%s only accepts instance of Symfony\Component\DependencyInjection\ContainerInterface or Symfony\Component\Translation\TranslatorInterface as first argument.', __CLASS__)); + throw new \InvalidArgumentException(sprintf('%s only accepts instance of Symfony\Component\DependencyInjection\ContainerInterface as first argument.', __CLASS__)); } } diff --git a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php index 9a60a92e85375..5d45efc7e2f0c 100644 --- a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php +++ b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php @@ -30,8 +30,8 @@ class TemplateCacheWarmer implements CacheWarmerInterface /** * TemplateCacheWarmer constructor. * - * @param ContainerInterface|Environment $container - * @param \Traversable $iterator + * @param ContainerInterface $container + * @param \Traversable $iterator */ public function __construct($container, \Traversable $iterator) { @@ -40,8 +40,9 @@ public function __construct($container, \Traversable $iterator) $this->container = $container; } elseif ($container instanceof Environment) { $this->twig = $container; + @trigger_error(sprintf('Using a "%s" as first argument of %s is deprecated since version 3.4 and will be unsupported in version 4.0. Use a %s instead.', Environment::class, __CLASS__, Container::class), E_USER_DEPRECATED); } else { - throw new \InvalidArgumentException(sprintf('%s only accepts instance of Symfony\Component\DependencyInjection\ContainerInterface or Environment as first argument.', __CLASS__)); + throw new \InvalidArgumentException(sprintf('%s only accepts instance of Symfony\Component\DependencyInjection\ContainerInterface as first argument.', __CLASS__)); } $this->iterator = $iterator; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy