|
16 | 16 | use Http\Message\Authentication\Wsse;
|
17 | 17 | use Psr\Http\Message\UriInterface;
|
18 | 18 | use Symfony\Component\Config\FileLocator;
|
| 19 | +use Symfony\Component\DependencyInjection\ChildDefinition; |
19 | 20 | use Symfony\Component\DependencyInjection\ContainerBuilder;
|
20 | 21 | use Symfony\Component\DependencyInjection\ContainerInterface;
|
21 | 22 | use Symfony\Component\DependencyInjection\Definition;
|
| 23 | +use Symfony\Component\DependencyInjection\DefinitionDecorator; |
22 | 24 | use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
23 | 25 | use Symfony\Component\DependencyInjection\Reference;
|
24 | 26 | use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
@@ -271,8 +273,12 @@ private function configureClient(ContainerBuilder $container, $clientName, array
|
271 | 273 | $plugins = array_merge($plugins, $this->configureAuthentication($container, $pluginConfig, $serviceId.'.authentication'));
|
272 | 274 | } else {
|
273 | 275 | $pluginServiceId = $serviceId.'.plugin.'.$pluginName;
|
274 |
| - $definition = clone $container->getDefinition('httplug.plugin'.'.'.$pluginName); |
275 |
| - $definition->setAbstract(false); |
| 276 | + |
| 277 | + $definition = class_exists(ChildDefinition::class) |
| 278 | + ? new ChildDefinition('httplug.plugin'.'.'.$pluginName) |
| 279 | + : new DefinitionDecorator('httplug.plugin'.'.'.$pluginName) |
| 280 | + ; |
| 281 | + |
276 | 282 | $this->configurePluginByName($pluginName, $definition, $pluginConfig, $container, $pluginServiceId);
|
277 | 283 | $container->setDefinition($pluginServiceId, $definition);
|
278 | 284 | $plugins[] = $pluginServiceId;
|
@@ -301,8 +307,11 @@ private function configureClient(ContainerBuilder $container, $clientName, array
|
301 | 307 | }
|
302 | 308 |
|
303 | 309 | // Add the newstack plugin
|
304 |
| - $definition = clone $container->getDefinition('httplug.plugin.stack'); |
305 |
| - $definition->setAbstract(false); |
| 310 | + $definition = class_exists(ChildDefinition::class) |
| 311 | + ? new ChildDefinition('httplug.plugin.stack') |
| 312 | + : new DefinitionDecorator('httplug.plugin.stack') |
| 313 | + ; |
| 314 | + |
306 | 315 | $definition->addArgument($clientName);
|
307 | 316 | $container->setDefinition($serviceId.'.plugin.newstack', $definition);
|
308 | 317 | array_unshift($plugins, $serviceId.'.plugin.newstack');
|
|
0 commit comments