Skip to content

Commit c0b0a9b

Browse files
committed
ISSUE-278:
- Updated naming strategy. Channel 'test' become '$testLogger' and etc.
1 parent a4cdaab commit c0b0a9b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

DependencyInjection/Compiler/LoggerChannelPass.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ protected function createLogger($channel, $loggerId, ContainerBuilder $container
152152

153153
// Allows only for Symfony 4.2+
154154
if (\method_exists($container, 'registerAliasForArgument')) {
155-
$container->registerAliasForArgument($loggerId, LoggerInterface::class);
155+
$parameterName = $channel . 'Logger';
156+
157+
$container->registerAliasForArgument($loggerId, LoggerInterface::class, $parameterName);
156158
}
157159
}
158160

Tests/DependencyInjection/Compiler/LoggerChannelPassTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function testProcess()
5353

5454
$this->assertNotNull($container->getDefinition('monolog.logger.additional'));
5555

56+
// test below acceptable only for Symfony 4.2+
5657
if (!\method_exists(ContainerBuilder::class, 'registerAliasForArgument')) {
5758
return;
5859
}
@@ -61,7 +62,7 @@ public function testProcess()
6162
$expectedChannels[] = 'additional';
6263

6364
foreach ($expectedChannels as $channelName) {
64-
$aliasName = LoggerInterface::class.' $monologLogger'.\ucfirst($channelName);
65+
$aliasName = LoggerInterface::class.' $' .$channelName.'Logger';
6566
$this->assertTrue($container->hasAlias($aliasName), 'type-hinted alias should be exists for each logger channel');
6667
}
6768
}

0 commit comments

Comments
 (0)