|
17 | 17 | use Symfony\Component\DependencyInjection\Definition; |
18 | 18 | use Symfony\Component\DependencyInjection\Reference; |
19 | 19 | use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; |
| 20 | +use Symfony\Component\DependencyInjection\Exception\RuntimeException; |
20 | 21 | use Symfony\Component\Config\Resource\FileResource; |
21 | 22 | use Symfony\Component\Yaml\Parser as YamlParser; |
22 | 23 | use Symfony\Component\ExpressionLanguage\Expression; |
@@ -74,7 +75,7 @@ public function load($resource, $type = null) |
74 | 75 | */ |
75 | 76 | public function supports($resource, $type = null) |
76 | 77 | { |
77 | | - return is_string($resource) && 'yml' === pathinfo($resource, PATHINFO_EXTENSION); |
| 78 | + return is_string($resource) && in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yml', 'yaml'), true); |
78 | 79 | } |
79 | 80 |
|
80 | 81 | /** |
@@ -288,6 +289,10 @@ private function parseDefinition($id, $service, $file) |
288 | 289 | */ |
289 | 290 | protected function loadFile($file) |
290 | 291 | { |
| 292 | + if (!class_exists('Symfony\Component\Yaml\Parser')) { |
| 293 | + throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.'); |
| 294 | + } |
| 295 | + |
291 | 296 | if (!stream_is_local($file)) { |
292 | 297 | throw new InvalidArgumentException(sprintf('This is not a local file "%s".', $file)); |
293 | 298 | } |
@@ -323,7 +328,7 @@ private function validate($content, $file) |
323 | 328 | throw new InvalidArgumentException(sprintf('The service file "%s" is not valid. It should contain an array. Check your YAML syntax.', $file)); |
324 | 329 | } |
325 | 330 |
|
326 | | - foreach (array_keys($content) as $namespace) { |
| 331 | + foreach ($content as $namespace => $data) { |
327 | 332 | if (in_array($namespace, array('imports', 'parameters', 'services'))) { |
328 | 333 | continue; |
329 | 334 | } |
|
0 commit comments