Skip to content

Commit dd53986

Browse files
committed
Do not perform service checks on non registered services
1 parent 4d6587d commit dd53986

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/batch-symfony-framework/src/DependencyInjection/CompilerPass/ConfigureTemplatingPass.php

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ final class ConfigureTemplatingPass implements CompilerPassInterface
1717
{
1818
public function process(ContainerBuilder $container): void
1919
{
20+
if (!$container->hasAlias(TemplatingInterface::class)) {
21+
return;
22+
}
23+
2024
$templatingActualService = (string)$container->getAlias(TemplatingInterface::class);
2125

2226
try {

src/batch-symfony-framework/tests/DependencyInjection/CompilerPass/ConfigureTemplatingPassTest.php

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ public function testNominal(): void
2323
self::assertTrue(true, 'No exception was raised');
2424
}
2525

26+
public function testMissingAlias(): void
27+
{
28+
$this->process(function (ContainerBuilder $container) {
29+
});
30+
31+
self::assertTrue(true, 'No exception was raised');
32+
}
33+
2634
public function testMissingService(): void
2735
{
2836
$this->expectExceptionObject(

0 commit comments

Comments
 (0)