[DI] Allow imports in string format for YAML
This commit is contained in:
parent
0bcc5afbda
commit
632e934cfa
@ -177,7 +177,10 @@ class YamlFileLoader extends FileLoader
|
||||
$defaultDirectory = dirname($file);
|
||||
foreach ($content['imports'] as $import) {
|
||||
if (!is_array($import)) {
|
||||
throw new InvalidArgumentException(sprintf('The values in the "imports" key should be arrays in %s. Check your YAML syntax.', $file));
|
||||
$import = array('resource' => $import);
|
||||
}
|
||||
if (!isset($import['resource'])) {
|
||||
throw new InvalidArgumentException(sprintf('An import should provide a resource in %s. Check your YAML syntax.', $file));
|
||||
}
|
||||
|
||||
$this->setCurrentDir($defaultDirectory);
|
||||
|
@ -1,2 +1,2 @@
|
||||
imports:
|
||||
- foo.yml
|
||||
- { resource: ~ }
|
||||
|
@ -1,5 +1,5 @@
|
||||
imports:
|
||||
- { resource: services2.yml }
|
||||
- services2.yml
|
||||
- { resource: services3.yml }
|
||||
- { resource: "../php/simple.php" }
|
||||
- { resource: "../ini/parameters.ini", class: Symfony\Component\DependencyInjection\Loader\IniFileLoader }
|
||||
|
Reference in New Issue
Block a user