From 648ed20e03eeacffa7b63ec01e2a8bf51ab527e1 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Sat, 26 Nov 2022 22:45:21 +0100 Subject: [PATCH] Autowire the PSR ClockInterface --- .../FrameworkBundle/DependencyInjection/FrameworkExtension.php | 2 ++ .../Bundle/FrameworkBundle/Resources/config/services.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index c3a97888851a..93d5de007ef9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -20,6 +20,7 @@ use PhpParser\Parser; use PHPStan\PhpDocParser\Parser\PhpDocParser; use Psr\Cache\CacheItemPoolInterface; +use Psr\Clock\ClockInterface as PsrClockInterface; use Psr\Container\ContainerInterface as PsrContainerInterface; use Psr\Http\Client\ClientInterface; use Psr\Log\LoggerAwareInterface; @@ -277,6 +278,7 @@ public function load(array $configs, ContainerBuilder $container) if (!ContainerBuilder::willBeAvailable('symfony/clock', ClockInterface::class, ['symfony/framework-bundle'])) { $container->removeDefinition('clock'); $container->removeAlias(ClockInterface::class); + $container->removeAlias(PsrClockInterface::class); } $container->registerAliasForArgument('parameter_bag', PsrContainerInterface::class); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.php index 40b6a5ac6c44..9facc09c783f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.php @@ -11,6 +11,7 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator; +use Psr\Clock\ClockInterface as PsrClockInterface; use Psr\EventDispatcher\EventDispatcherInterface as PsrEventDispatcherInterface; use Symfony\Bundle\FrameworkBundle\CacheWarmer\ConfigBuilderCacheWarmer; use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache; @@ -230,6 +231,7 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : [] ->set('clock', NativeClock::class) ->alias(ClockInterface::class, 'clock') + ->alias(PsrClockInterface::class, 'clock') // register as abstract and excluded, aka not-autowirable types ->set(LoaderInterface::class)->abstract()->tag('container.excluded')