Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b9c91cd

Browse filesBrowse files
committed
Deprecate passing a concrete service in optional cache warmers
1 parent 068f8d1 commit b9c91cd
Copy full SHA for b9c91cd

File tree

3 files changed

+9
-5
lines changed
Filter options

3 files changed

+9
-5
lines changed

‎src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php
+2Lines 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 <fabien@symfony.com>
22+
*
23+
* @final since version 3.4, to be given a container instead in 4.0
2224
*/
2325
class RouterCacheWarmer implements CacheWarmerInterface
2426
{

‎src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php
+3-2Lines 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

‎src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class TemplateCacheWarmer implements CacheWarmerInterface
3030
/**
3131
* TemplateCacheWarmer constructor.
3232
*
33-
* @param ContainerInterface|Environment $container
34-
* @param \Traversable $iterator
33+
* @param ContainerInterface $container
34+
* @param \Traversable $iterator
3535
*/
3636
public function __construct($container, \Traversable $iterator)
3737
{
@@ -40,8 +40,9 @@ public function __construct($container, \Traversable $iterator)
4040
$this->container = $container;
4141
} elseif ($container instanceof Environment) {
4242
$this->twig = $container;
43+
@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);
4344
} else {
44-
throw new \InvalidArgumentException(sprintf('%s only accepts instance of Symfony\Component\DependencyInjection\ContainerInterface or Environment as first argument.', __CLASS__));
45+
throw new \InvalidArgumentException(sprintf('%s only accepts instance of Symfony\Component\DependencyInjection\ContainerInterface as first argument.', __CLASS__));
4546
}
4647

4748
$this->iterator = $iterator;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.