|
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 | /** |
@@ -295,6 +296,10 @@ private function parseDefinition($id, $service, $file) |
295 | 296 | */ |
296 | 297 | protected function loadFile($file) |
297 | 298 | { |
| 299 | + if (!class_exists('Symfony\Component\Yaml\Parser')) { |
| 300 | + throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.'); |
| 301 | + } |
| 302 | + |
298 | 303 | if (!stream_is_local($file)) { |
299 | 304 | throw new InvalidArgumentException(sprintf('This is not a local file "%s".', $file)); |
300 | 305 | } |
@@ -330,7 +335,7 @@ private function validate($content, $file) |
330 | 335 | throw new InvalidArgumentException(sprintf('The service file "%s" is not valid. It should contain an array. Check your YAML syntax.', $file)); |
331 | 336 | } |
332 | 337 |
|
333 | | - foreach (array_keys($content) as $namespace) { |
| 338 | + foreach ($content as $namespace => $data) { |
334 | 339 | if (in_array($namespace, array('imports', 'parameters', 'services'))) { |
335 | 340 | continue; |
336 | 341 | } |
|
0 commit comments