Allow setting services as null

This commit is contained in:
WouterJ 2017-01-09 12:25:00 +01:00
parent e6bd47e457
commit 28a1b5ac47
2 changed files with 6 additions and 0 deletions

View File

@ -220,6 +220,10 @@ class YamlFileLoader extends FileLoader
return;
}
if (null === $service) {
$service = array();
}
if (!is_array($service)) {
throw new InvalidArgumentException(sprintf('A service definition must be an array or a string starting with "@" but %s found for service "%s" in %s. Check your YAML syntax.', gettype($service), $id, $file));
}

View File

@ -5,6 +5,8 @@ services:
tags:
- name: foo
Acme\Foo: ~
with_defaults:
class: Foo