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 9d24e80

Browse filesBrowse files
feature #23035 [3.4] Deprecate passing a concrete service in optional cache warmers (romainneutron)
This PR was merged into the 3.4 branch. Discussion ---------- [3.4] Deprecate passing a concrete service in optional cache warmers | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | yes <!-- don't forget updating UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | N/A | License | MIT Commits ------- b9c91cd Deprecate passing a concrete service in optional cache warmers
2 parents 4fbc2a6 + b9c91cd commit 9d24e80
Copy full SHA for 9d24e80

File tree

3 files changed

+7
-3
lines changed
Filter options

3 files changed

+7
-3
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
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class TranslationsCacheWarmer implements CacheWarmerInterface, ServiceSubscriber
3030
/**
3131
* TranslationsCacheWarmer constructor.
3232
*
33-
* @param ContainerInterface|TranslatorInterface $container
33+
* @param ContainerInterface $container
3434
*/
3535
public function __construct($container)
3636
{
@@ -39,6 +39,7 @@ public function __construct($container)
3939
$this->container = $container;
4040
} elseif ($container instanceof TranslatorInterface) {
4141
$this->translator = $container;
42+
@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);
4243
} else {
4344
throw new \InvalidArgumentException(sprintf('%s only accepts instance of Psr\Container\ContainerInterface as first argument.', __CLASS__));
4445
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class TemplateCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInte
3131
/**
3232
* TemplateCacheWarmer constructor.
3333
*
34-
* @param ContainerInterface|Environment $container
35-
* @param \Traversable $iterator
34+
* @param ContainerInterface $container
35+
* @param \Traversable $iterator
3636
*/
3737
public function __construct($container, \Traversable $iterator)
3838
{
@@ -41,6 +41,7 @@ public function __construct($container, \Traversable $iterator)
4141
$this->container = $container;
4242
} elseif ($container instanceof Environment) {
4343
$this->twig = $container;
44+
@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);
4445
} else {
4546
throw new \InvalidArgumentException(sprintf('%s only accepts instance of Psr\Container\ContainerInterface as first argument.', __CLASS__));
4647
}

0 commit comments

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