Skip to content

Commit 92a2738

Browse files
committed
Deprecate passing a concrete service in optional cache warmers
1 parent d7326cc commit 92a2738

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CacheWarmer/RouterCacheWarmer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* Generates the router matcher and generator classes.
2020
*
2121
* @author Fabien Potencier <[email protected]>
22+
*
23+
* @final since version 3.4, to be given a container instead in 4.0
2224
*/
2325
class RouterCacheWarmer implements CacheWarmerInterface
2426
{

CacheWarmer/TranslationsCacheWarmer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class TranslationsCacheWarmer implements CacheWarmerInterface
2929
/**
3030
* TranslationsCacheWarmer constructor.
3131
*
32-
* @param ContainerInterface|TranslatorInterface $container
32+
* @param ContainerInterface $container
3333
*/
3434
public function __construct($container)
3535
{
@@ -38,8 +38,9 @@ public function __construct($container)
3838
$this->container = $container;
3939
} elseif ($container instanceof TranslatorInterface) {
4040
$this->translator = $container;
41+
@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);
4142
} else {
42-
throw new \InvalidArgumentException(sprintf('%s only accepts instance of Symfony\Component\DependencyInjection\ContainerInterface or Symfony\Component\Translation\TranslatorInterface as first argument.', __CLASS__));
43+
throw new \InvalidArgumentException(sprintf('%s only accepts instance of Symfony\Component\DependencyInjection\ContainerInterface as first argument.', __CLASS__));
4344
}
4445
}
4546

0 commit comments

Comments
 (0)