From 9667b1f6b54b7553b38f6a8045a74c0d4a3c6024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Mon, 3 Jun 2019 17:10:06 +0200 Subject: [PATCH] Fixed previous commit (CS) --- CHANGELOG.md | 2 +- DependencyInjection/MonologExtension.php | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f73ca5d3..7ed1f3d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ * Fixed psr-3 processing being applied to all handlers, only leaf ones are now processing * Fixed regression when `app` channel is defined explicitly * Fixed handlers marked as nested not being ignored properly from the stack -* Added configuration support for Redis +* Added support for Redis configuration ## 3.3.1 (2018-11-04) diff --git a/DependencyInjection/MonologExtension.php b/DependencyInjection/MonologExtension.php index 02bfbecd..ab8ca555 100644 --- a/DependencyInjection/MonologExtension.php +++ b/DependencyInjection/MonologExtension.php @@ -13,8 +13,6 @@ use Monolog\Processor\ProcessorInterface; use Monolog\ResettableInterface; -use Predis; -use Redis; use Symfony\Bridge\Monolog\Handler\FingersCrossed\HttpCodeActivationStrategy; use Symfony\Bridge\Monolog\Processor\TokenProcessor; use Symfony\Bridge\Monolog\Processor\WebProcessor; @@ -318,11 +316,11 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler if (isset($handler['redis']['id'])) { $clientId = $handler['redis']['id']; } elseif ('redis' === $handler['type']) { - if (!class_exists(Redis::class)) { + if (!class_exists(\Redis::class)) { throw new \RuntimeException('The \Redis class is not available.'); } - $client = new Definition('\Redis'); + $client = new Definition(\Redis::class); $client->addMethodCall('connect', array($handler['redis']['host'], $handler['redis']['port'])); $client->addMethodCall('auth', array($handler['redis']['password'])); $client->addMethodCall('select', array($handler['redis']['database'])); @@ -330,11 +328,11 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler $clientId = uniqid('monolog.redis.client.', true); $container->setDefinition($clientId, $client); } else { - if (!class_exists(Predis\Client::class)) { + if (!class_exists(\Predis\Client::class)) { throw new \RuntimeException('The \Predis\Client class is not available.'); } - $client = new Definition('\Predis\Client'); + $client = new Definition(\Predis\Client::class); $client->setArguments(array( $handler['redis']['host'], ));