Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 28a1b5a

Browse files
committed
Allow setting services as null
1 parent e6bd47e commit 28a1b5a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ private function parseDefinition($id, $service, $file, array $defaults)
220220
return;
221221
}
222222

223+
if (null === $service) {
224+
$service = array();
225+
}
226+
223227
if (!is_array($service)) {
224228
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));
225229
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services28.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ services:
55
tags:
66
- name: foo
77

8+
Acme\Foo: ~
9+
810
with_defaults:
911
class: Foo
1012

0 commit comments

Comments
 (0)