use the parseFile() method of the YAML parser

This commit is contained in:
Christian Flothmann 2017-09-25 21:59:34 +02:00
parent 1b4d2b246d
commit 8bf465f48d
7 changed files with 9 additions and 9 deletions

View File

@ -654,7 +654,7 @@ class YamlFileLoader extends FileLoader
}
try {
$configuration = $this->yamlParser->parse(file_get_contents($file), Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
$configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
} catch (ParseException $e) {
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e);
}

View File

@ -58,7 +58,7 @@ class YamlFileLoader extends FileLoader
}
try {
$parsedConfig = $this->yamlParser->parse(file_get_contents($path));
$parsedConfig = $this->yamlParser->parseFile($path);
} catch (ParseException $e) {
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
}

View File

@ -21,7 +21,7 @@
"require-dev": {
"symfony/config": "~2.8|~3.0|~4.0",
"symfony/http-foundation": "~2.8|~3.0|~4.0",
"symfony/yaml": "~3.3|~4.0",
"symfony/yaml": "~3.4|~4.0",
"symfony/expression-language": "~2.8|~3.0|~4.0",
"symfony/dependency-injection": "~3.3|~4.0",
"doctrine/annotations": "~1.0",
@ -31,7 +31,7 @@
"conflict": {
"symfony/config": "<2.8",
"symfony/dependency-injection": "<3.3",
"symfony/yaml": "<3.3"
"symfony/yaml": "<3.4"
},
"suggest": {
"symfony/http-foundation": "For using a Symfony Request object",

View File

@ -113,7 +113,7 @@ class YamlFileLoader extends FileLoader
$this->yamlParser = new Parser();
}
$classes = $this->yamlParser->parse(file_get_contents($this->file));
$classes = $this->yamlParser->parseFile($this->file);
if (empty($classes)) {
return array();

View File

@ -39,7 +39,7 @@ class YamlFileLoader extends FileLoader
}
try {
$messages = $this->yamlParser->parse(file_get_contents($resource));
$messages = $this->yamlParser->parseFile($resource);
} catch (ParseException $e) {
throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e);
}

View File

@ -23,14 +23,14 @@
"symfony/config": "~2.8|~3.0|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/intl": "^2.8.18|^3.2.5|~4.0",
"symfony/yaml": "~3.3|~4.0",
"symfony/yaml": "~3.4|~4.0",
"symfony/finder": "~2.8|~3.0|~4.0",
"psr/log": "~1.0"
},
"conflict": {
"symfony/config": "<2.8",
"symfony/dependency-injection": "<3.4",
"symfony/yaml": "<3.3"
"symfony/yaml": "<3.4"
},
"suggest": {
"symfony/config": "",

View File

@ -116,7 +116,7 @@ class YamlFileLoader extends FileLoader
private function parseFile($path)
{
try {
$classes = $this->yamlParser->parse(file_get_contents($path), Yaml::PARSE_CONSTANT);
$classes = $this->yamlParser->parseFile($path, Yaml::PARSE_CONSTANT);
} catch (ParseException $e) {
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
}