Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3f29df4

Browse files
committed
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 | #24253 (comment) | License | MIT | Doc PR | Commits ------- 8bf465f use the parseFile() method of the YAML parser
2 parents 1b4d2b2 + 8bf465f commit 3f29df4

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ protected function loadFile($file)
654654
}
655655

656656
try {
657-
$configuration = $this->yamlParser->parse(file_get_contents($file), Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
657+
$configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
658658
} catch (ParseException $e) {
659659
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e);
660660
}

src/Symfony/Component/Routing/Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function load($file, $type = null)
5858
}
5959

6060
try {
61-
$parsedConfig = $this->yamlParser->parse(file_get_contents($path));
61+
$parsedConfig = $this->yamlParser->parseFile($path);
6262
} catch (ParseException $e) {
6363
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
6464
}

src/Symfony/Component/Routing/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"require-dev": {
2222
"symfony/config": "~2.8|~3.0|~4.0",
2323
"symfony/http-foundation": "~2.8|~3.0|~4.0",
24-
"symfony/yaml": "~3.3|~4.0",
24+
"symfony/yaml": "~3.4|~4.0",
2525
"symfony/expression-language": "~2.8|~3.0|~4.0",
2626
"symfony/dependency-injection": "~3.3|~4.0",
2727
"doctrine/annotations": "~1.0",
@@ -31,7 +31,7 @@
3131
"conflict": {
3232
"symfony/config": "<2.8",
3333
"symfony/dependency-injection": "<3.3",
34-
"symfony/yaml": "<3.3"
34+
"symfony/yaml": "<3.4"
3535
},
3636
"suggest": {
3737
"symfony/http-foundation": "For using a Symfony Request object",

src/Symfony/Component/Serializer/Mapping/Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private function getClassesFromYaml()
113113
$this->yamlParser = new Parser();
114114
}
115115

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

118118
if (empty($classes)) {
119119
return array();

src/Symfony/Component/Translation/Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected function loadResource($resource)
3939
}
4040

4141
try {
42-
$messages = $this->yamlParser->parse(file_get_contents($resource));
42+
$messages = $this->yamlParser->parseFile($resource);
4343
} catch (ParseException $e) {
4444
throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e);
4545
}

src/Symfony/Component/Translation/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
"symfony/config": "~2.8|~3.0|~4.0",
2424
"symfony/dependency-injection": "~3.4|~4.0",
2525
"symfony/intl": "^2.8.18|^3.2.5|~4.0",
26-
"symfony/yaml": "~3.3|~4.0",
26+
"symfony/yaml": "~3.4|~4.0",
2727
"symfony/finder": "~2.8|~3.0|~4.0",
2828
"psr/log": "~1.0"
2929
},
3030
"conflict": {
3131
"symfony/config": "<2.8",
3232
"symfony/dependency-injection": "<3.4",
33-
"symfony/yaml": "<3.3"
33+
"symfony/yaml": "<3.4"
3434
},
3535
"suggest": {
3636
"symfony/config": "",

src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ protected function parseNodes(array $nodes)
116116
private function parseFile($path)
117117
{
118118
try {
119-
$classes = $this->yamlParser->parse(file_get_contents($path), Yaml::PARSE_CONSTANT);
119+
$classes = $this->yamlParser->parseFile($path, Yaml::PARSE_CONSTANT);
120120
} catch (ParseException $e) {
121121
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
122122
}

0 commit comments

Comments
 (0)