Skip to content

Commit 40acadf

Browse files
authored
Merge pull request #141 from stof/remove_useless_listener
Avoid registering the strategy listener when it is useless
2 parents 57b3086 + 48cdf91 commit 40acadf

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
@@ -420,6 +420,12 @@ private function configureAutoDiscoveryClients(ContainerBuilder $container, arra
420420
$asyncHttpClient = new Reference($asyncHttpClient);
421421
}
422422

423+
if (null === $httpClient && null === $asyncHttpClient) {
424+
$container->removeDefinition('httplug.strategy');
425+
426+
return;
427+
}
428+
423429
$container
424430
->getDefinition('httplug.strategy')
425431
->addArgument($httpClient)

0 commit comments

Comments
 (0)