Skip to content

Commit 648ed20

Browse files
committed
Autowire the PSR ClockInterface
1 parent a97d79a commit 648ed20

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use PhpParser\Parser;
2121
use PHPStan\PhpDocParser\Parser\PhpDocParser;
2222
use Psr\Cache\CacheItemPoolInterface;
23+
use Psr\Clock\ClockInterface as PsrClockInterface;
2324
use Psr\Container\ContainerInterface as PsrContainerInterface;
2425
use Psr\Http\Client\ClientInterface;
2526
use Psr\Log\LoggerAwareInterface;
@@ -277,6 +278,7 @@ public function load(array $configs, ContainerBuilder $container)
277278
if (!ContainerBuilder::willBeAvailable('symfony/clock', ClockInterface::class, ['symfony/framework-bundle'])) {
278279
$container->removeDefinition('clock');
279280
$container->removeAlias(ClockInterface::class);
281+
$container->removeAlias(PsrClockInterface::class);
280282
}
281283

282284
$container->registerAliasForArgument('parameter_bag', PsrContainerInterface::class);

src/Symfony/Bundle/FrameworkBundle/Resources/config/services.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
1313

14+
use Psr\Clock\ClockInterface as PsrClockInterface;
1415
use Psr\EventDispatcher\EventDispatcherInterface as PsrEventDispatcherInterface;
1516
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ConfigBuilderCacheWarmer;
1617
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
@@ -230,6 +231,7 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : []
230231

231232
->set('clock', NativeClock::class)
232233
->alias(ClockInterface::class, 'clock')
234+
->alias(PsrClockInterface::class, 'clock')
233235

234236
// register as abstract and excluded, aka not-autowirable types
235237
->set(LoaderInterface::class)->abstract()->tag('container.excluded')

0 commit comments

Comments
 (0)