From 2a68e2891f7016790ef754f21274d873c8ef666c Mon Sep 17 00:00:00 2001 From: Mihail Chervontsev Date: Thu, 9 Feb 2023 11:41:52 +0300 Subject: [PATCH] Fix deprecation notices for single colon routes definitions https://symfony.com/blog/new-in-symfony-4-1-deprecated-the-bundle-notation --- .../DependencyInjection/LamodaMetricExtension.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/MetricBundle/DependencyInjection/LamodaMetricExtension.php b/src/MetricBundle/DependencyInjection/LamodaMetricExtension.php index 0725163..58e1675 100644 --- a/src/MetricBundle/DependencyInjection/LamodaMetricExtension.php +++ b/src/MetricBundle/DependencyInjection/LamodaMetricExtension.php @@ -14,6 +14,7 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension; +use Symfony\Component\HttpKernel\Kernel; final class LamodaMetricExtension extends ConfigurableExtension { @@ -79,6 +80,10 @@ private function processSources(ContainerBuilder $container, array $sources): vo private function processResponders(ContainerBuilder $container, array $config): void { $routerLoader = $container->getDefinition('lamoda_metrics.route_loader'); + $separator = ':'; + if (Kernel::VERSION_ID >= 40100) { + $separator = '::'; + } foreach ($config as $name => $responderConfig) { if (!$responderConfig['enabled']) { @@ -102,7 +107,8 @@ private function processResponders(ContainerBuilder $container, array $config): $controller->setArguments([$psrController]); $path = $responderConfig['path'] ?? '/' . $name; - $routerLoader->addMethodCall('registerController', [$name, $path, $controllerId . ':createResponse']); + + $routerLoader->addMethodCall('registerController', [$name, $path, $controllerId . $separator . 'createResponse']); } } }