diff --git a/src/Symfony/Component/Yaml/Tests/YamlTest.php b/src/Symfony/Component/Yaml/Tests/YamlTest.php index 53b0bfaaebfee..ee008cf1cd140 100644 --- a/src/Symfony/Component/Yaml/Tests/YamlTest.php +++ b/src/Symfony/Component/Yaml/Tests/YamlTest.php @@ -22,13 +22,4 @@ public function testParseAndDump() $parsed = Yaml::parse($yml); $this->assertEquals($data, $parsed); } - - public function testParseFromFile() - { - $filename = __DIR__.'/Fixtures/index.yml'; - $contents = file_get_contents($filename); - $parsedByFilename = Yaml::parse($filename); - $parsedByContents = Yaml::parse($contents); - $this->assertEquals($parsedByFilename, $parsedByContents); - } } diff --git a/src/Symfony/Component/Yaml/Yaml.php b/src/Symfony/Component/Yaml/Yaml.php index 0c3ada73568dc..7d9e298169b53 100644 --- a/src/Symfony/Component/Yaml/Yaml.php +++ b/src/Symfony/Component/Yaml/Yaml.php @@ -34,11 +34,7 @@ class Yaml * print_r($array); * * - * As this method accepts both plain strings and file names as an input, - * you must validate the input before calling this method. Passing a file - * as an input is a deprecated feature and will be removed in 3.0. - * - * @param string $input Path to a YAML file or a string containing YAML + * @param string $input A string containing YAML * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise * @param bool $objectSupport True if object support is enabled, false otherwise * @@ -46,36 +42,13 @@ class Yaml * * @throws ParseException If the YAML is not valid * - * @deprecated The ability to pass file names to Yaml::parse() was deprecated in 2.2 and will be removed in 3.0. Please, pass the contents of the file instead. - * * @api */ public static function parse($input, $exceptionOnInvalidType = false, $objectSupport = false) { - // if input is a file, process it - $file = ''; - if (strpos($input, "\n") === false && is_file($input)) { - trigger_error('The ability to pass file names to Yaml::parse() was deprecated in 2.2 and will be removed in 3.0. Please, pass the contents of the file instead.', E_USER_DEPRECATED); - - if (false === is_readable($input)) { - throw new ParseException(sprintf('Unable to parse "%s" as the file is not readable.', $input)); - } - - $file = $input; - $input = file_get_contents($file); - } - $yaml = new Parser(); - try { - return $yaml->parse($input, $exceptionOnInvalidType, $objectSupport); - } catch (ParseException $e) { - if ($file) { - $e->setParsedFile($file); - } - - throw $e; - } + return $yaml->parse($input, $exceptionOnInvalidType, $objectSupport); } /** pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy