Skip to content

Commit

Permalink
Fix bug and add deprecated warning for removed
Browse files Browse the repository at this point in the history
  • Loading branch information
inverse committed Sep 2, 2019
1 parent 69e9e4b commit 88682e2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions DependencyInjection/MonologExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -951,11 +951,18 @@ private function getHandlerClassByType($handlerType)

if (Logger::API === 2) {
$typeToClassMapping = array_merge($typeToClassMapping, $v2HandlerTypesAdded);
foreach($v2HandlerTypesRemoved as $handlerType) {
unset($typeToClassMapping[$handlerType]);
foreach($v2HandlerTypesRemoved as $v2HandlerTypeRemoved) {
unset($typeToClassMapping[$v2HandlerTypeRemoved]);
}
}

if (Logger::API === 1 && array_key_exists($handlerType, $v2HandlerTypesRemoved)) {
@trigger_error(
sprintf('"%s" is deprecated and will be removed in MonoLog v2.', $handlerType),
E_USER_DEPRECATED
);
}

if (!isset($typeToClassMapping[$handlerType])) {
if (Logger::API === 1 && array_key_exists($handlerType, $v2HandlerTypesAdded)) {
throw new InvalidArgumentException(
Expand Down

0 comments on commit 88682e2

Please sign in to comment.