Skip to content

Commit

Permalink
minor #24322 [DependencyInjection][Routing][Serializer][Translations]…
Browse files Browse the repository at this point in the history
…[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 | #24253 (comment)
| License       | MIT
| Doc PR        |

Commits
-------

8bf465f use the parseFile() method of the YAML parser
  • Loading branch information
fabpot committed Sep 26, 2017
2 parents 1b4d2b2 + 8bf465f commit 3f29df4
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ protected function loadFile($file)
}

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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Routing/Loader/YamlFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function load($file, $type = null)
}

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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Routing/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private function getClassesFromYaml()
$this->yamlParser = new Parser();
}

$classes = $this->yamlParser->parse(file_get_contents($this->file));
$classes = $this->yamlParser->parseFile($this->file);

if (empty($classes)) {
return array();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function loadResource($resource)
}

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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Translation/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protected function parseNodes(array $nodes)
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);
}
Expand Down

0 comments on commit 3f29df4

Please sign in to comment.