From 8bf465f48d3560f97b0a27b37222e812f6a3fd09 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 25 Sep 2017 21:59:34 +0200 Subject: [PATCH] use the parseFile() method of the YAML parser --- .../Component/DependencyInjection/Loader/YamlFileLoader.php | 2 +- src/Symfony/Component/Routing/Loader/YamlFileLoader.php | 2 +- src/Symfony/Component/Routing/composer.json | 4 ++-- .../Component/Serializer/Mapping/Loader/YamlFileLoader.php | 2 +- src/Symfony/Component/Translation/Loader/YamlFileLoader.php | 2 +- src/Symfony/Component/Translation/composer.json | 4 ++-- .../Component/Validator/Mapping/Loader/YamlFileLoader.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index be0c75b2ca..d9fd24c3d7 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -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); } diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php index 5a08751321..f3072c927b 100644 --- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -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); } diff --git a/src/Symfony/Component/Routing/composer.json b/src/Symfony/Component/Routing/composer.json index 1226ffde88..2ad746ec53 100644 --- a/src/Symfony/Component/Routing/composer.json +++ b/src/Symfony/Component/Routing/composer.json @@ -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", diff --git a/src/Symfony/Component/Serializer/Mapping/Loader/YamlFileLoader.php b/src/Symfony/Component/Serializer/Mapping/Loader/YamlFileLoader.php index e3afa47632..970241d347 100644 --- a/src/Symfony/Component/Serializer/Mapping/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Serializer/Mapping/Loader/YamlFileLoader.php @@ -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(); diff --git a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php index 41e390d0e9..874fa3a894 100644 --- a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php @@ -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); } diff --git a/src/Symfony/Component/Translation/composer.json b/src/Symfony/Component/Translation/composer.json index 48873b9826..3a1e1589f5 100644 --- a/src/Symfony/Component/Translation/composer.json +++ b/src/Symfony/Component/Translation/composer.json @@ -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": "", diff --git a/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php index ff6c65d05e..e5e84c38c3 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php @@ -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); }