From 6850a228a719d5e3bf0928f36d005b18d77fe7b0 Mon Sep 17 00:00:00 2001 From: Niels Keurentjes Date: Wed, 3 Jan 2018 12:24:16 +0100 Subject: [PATCH] [DX] [DI] Improve exception for invalid setter injection arguments --- .../Component/DependencyInjection/Loader/YamlFileLoader.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 7240fb5812985..79adcf2161b7a 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -476,6 +476,9 @@ private function parseDefinition($id, $service, $file, array $defaults) $args = isset($call[1]) ? $this->resolveServices($call[1], $file) : array(); } + if (!is_array($args)) { + throw new InvalidArgumentException(sprintf('The second parameter for function call "%s" must be an array of its arguments for service "%s" in %s. Check your YAML syntax.', $method, $id, $file)); + } $definition->addMethodCall($method, $args); } }