Deprecate passing a concrete service in optional cache warmers
This commit is contained in:
parent
068f8d1341
commit
b9c91cd88c
@ -19,6 +19,8 @@ use Symfony\Component\Routing\RouterInterface;
|
||||
* Generates the router matcher and generator classes.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final since version 3.4, to be given a container instead in 4.0
|
||||
*/
|
||||
class RouterCacheWarmer implements CacheWarmerInterface
|
||||
{
|
||||
|
@ -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 @@ class TranslationsCacheWarmer implements CacheWarmerInterface
|
||||
$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__));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 @@ class TemplateCacheWarmer implements CacheWarmerInterface
|
||||
$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;
|
||||
|
Reference in New Issue
Block a user