Skip to content

[3.4] Deprecate passing a concrete service in optional cache warmers #23035

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
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* 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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TranslationsCacheWarmer implements CacheWarmerInterface
/**
* TranslationsCacheWarmer constructor.
*
* @param ContainerInterface|TranslatorInterface $container
* @param ContainerInterface $container
*/
public function __construct($container)
{
Expand All @@ -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__));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down
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