Skip to content

Commit 0f83a8e

Browse files
committed
Warn when defining null handlers empty, fixes #284
1 parent 70d8645 commit 0f83a8e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

DependencyInjection/MonologExtension.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,12 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
726726
break;
727727

728728
default:
729-
throw new \InvalidArgumentException(sprintf('Invalid handler type "%s" given for handler "%s"', $handler['type'], $name));
729+
$nullWarning = '';
730+
if ($handler['type'] == '') {
731+
$nullWarning = ', if you meant to define a null handler in a yaml config, make sure you quote "null" so it does not get converted to a php null';
732+
}
733+
734+
throw new \InvalidArgumentException(sprintf('Invalid handler type "%s" given for handler "%s"' . $nullWarning, $handler['type'], $name));
730735
}
731736

732737
if (!empty($handler['nested']) && true === $handler['nested']) {

0 commit comments

Comments
 (0)