use the parseFile() method of the YAML parser
This commit is contained in:
parent
1b4d2b246d
commit
8bf465f48d
@ -654,7 +654,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
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) {
|
} catch (ParseException $e) {
|
||||||
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e);
|
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$parsedConfig = $this->yamlParser->parse(file_get_contents($path));
|
$parsedConfig = $this->yamlParser->parseFile($path);
|
||||||
} catch (ParseException $e) {
|
} catch (ParseException $e) {
|
||||||
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
|
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/config": "~2.8|~3.0|~4.0",
|
"symfony/config": "~2.8|~3.0|~4.0",
|
||||||
"symfony/http-foundation": "~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/expression-language": "~2.8|~3.0|~4.0",
|
||||||
"symfony/dependency-injection": "~3.3|~4.0",
|
"symfony/dependency-injection": "~3.3|~4.0",
|
||||||
"doctrine/annotations": "~1.0",
|
"doctrine/annotations": "~1.0",
|
||||||
@ -31,7 +31,7 @@
|
|||||||
"conflict": {
|
"conflict": {
|
||||||
"symfony/config": "<2.8",
|
"symfony/config": "<2.8",
|
||||||
"symfony/dependency-injection": "<3.3",
|
"symfony/dependency-injection": "<3.3",
|
||||||
"symfony/yaml": "<3.3"
|
"symfony/yaml": "<3.4"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"symfony/http-foundation": "For using a Symfony Request object",
|
"symfony/http-foundation": "For using a Symfony Request object",
|
||||||
|
@ -113,7 +113,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
$this->yamlParser = new Parser();
|
$this->yamlParser = new Parser();
|
||||||
}
|
}
|
||||||
|
|
||||||
$classes = $this->yamlParser->parse(file_get_contents($this->file));
|
$classes = $this->yamlParser->parseFile($this->file);
|
||||||
|
|
||||||
if (empty($classes)) {
|
if (empty($classes)) {
|
||||||
return array();
|
return array();
|
||||||
|
@ -39,7 +39,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$messages = $this->yamlParser->parse(file_get_contents($resource));
|
$messages = $this->yamlParser->parseFile($resource);
|
||||||
} catch (ParseException $e) {
|
} catch (ParseException $e) {
|
||||||
throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e);
|
throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e);
|
||||||
}
|
}
|
||||||
|
@ -23,14 +23,14 @@
|
|||||||
"symfony/config": "~2.8|~3.0|~4.0",
|
"symfony/config": "~2.8|~3.0|~4.0",
|
||||||
"symfony/dependency-injection": "~3.4|~4.0",
|
"symfony/dependency-injection": "~3.4|~4.0",
|
||||||
"symfony/intl": "^2.8.18|^3.2.5|~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",
|
"symfony/finder": "~2.8|~3.0|~4.0",
|
||||||
"psr/log": "~1.0"
|
"psr/log": "~1.0"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"symfony/config": "<2.8",
|
"symfony/config": "<2.8",
|
||||||
"symfony/dependency-injection": "<3.4",
|
"symfony/dependency-injection": "<3.4",
|
||||||
"symfony/yaml": "<3.3"
|
"symfony/yaml": "<3.4"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"symfony/config": "",
|
"symfony/config": "",
|
||||||
|
@ -116,7 +116,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
private function parseFile($path)
|
private function parseFile($path)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$classes = $this->yamlParser->parse(file_get_contents($path), Yaml::PARSE_CONSTANT);
|
$classes = $this->yamlParser->parseFile($path, Yaml::PARSE_CONSTANT);
|
||||||
} catch (ParseException $e) {
|
} catch (ParseException $e) {
|
||||||
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
|
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user