Skip to content

Commit d42e280

Browse 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 31d584e + 92a2738 commit d42e280

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
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: 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
}

0 commit comments

Comments
 (0)