minor #24322 [DependencyInjection][Routing][Serializer][Translations][Validator] use the parseFile() method of the YAML parser (xabbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[DependencyInjection][Routing][Serializer][Translations][Validator] use the parseFile() method of the YAML parser

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/24253#issuecomment-331917180
| License       | MIT
| Doc PR        |

Commits
-------

8bf465f48d use the parseFile() method of the YAML parser
This commit is contained in:
Fabien Potencier 2017-09-26 05:05:38 +02:00
commit 3f29df408d
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);
}