Skip to content

Commit 48cdf91

Browse files
committed
Avoid registering the strategy listener when it is useless
If both the client and the async client are null, the strategy would never find any candidates. In such case, it is useless to register it as a kernel.request listener to prepend itself to the discovery.
1 parent 2bcd28d commit 48cdf91

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

DependencyInjection/HttplugExtension.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,12 @@ private function configureAutoDiscoveryClients(ContainerBuilder $container, arra
411411
$asyncHttpClient = new Reference($asyncHttpClient);
412412
}
413413

414+
if (null === $httpClient && null === $asyncHttpClient) {
415+
$container->removeDefinition('httplug.strategy');
416+
417+
return;
418+
}
419+
414420
$container
415421
->getDefinition('httplug.strategy')
416422
->addArgument($httpClient)

0 commit comments

Comments
 (0)