Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Yaml] renamed load() to parse()

  • Loading branch information...
commit 3859589daac0a6562faa81807d2fabfa657bfead 1 parent 9b1b937
@fabpot fabpot authored
View
2  UPDATE.md
@@ -9,6 +9,8 @@ timeline closely anyway.
beta4 to beta5
--------------
+* `Yaml::load()` has been renamed to `Yaml::parse()`
+
* The `extensions` setting for Twig has been removed. There is now only one
way to register Twig extensions, via the `twig.extension` tag.
View
2  src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
@@ -228,7 +228,7 @@ private function parseDefinition($id, $service, $file)
*/
private function loadFile($file)
{
- return $this->validate(Yaml::load($file), $file);
+ return $this->validate(Yaml::parse($file), $file);
}
/**
View
2  src/Symfony/Component/Routing/Loader/YamlFileLoader.php
@@ -46,7 +46,7 @@ public function load($file, $type = null)
{
$path = $this->locator->locate($file);
- $config = Yaml::load($path);
+ $config = Yaml::parse($path);
$collection = new RouteCollection();
$collection->addResource(new FileResource($path));
View
2  src/Symfony/Component/Translation/Loader/YamlFileLoader.php
@@ -30,7 +30,7 @@ class YamlFileLoader extends ArrayLoader implements LoaderInterface
*/
public function load($resource, $locale, $domain = 'messages')
{
- $messages = Yaml::load($resource);
+ $messages = Yaml::parse($resource);
// empty file
if (null === $messages) {
View
2  src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php
@@ -29,7 +29,7 @@ class YamlFileLoader extends FileLoader
public function loadClassMetadata(ClassMetadata $metadata)
{
if (null === $this->classes) {
- $this->classes = Yaml::load($this->file);
+ $this->classes = Yaml::parse($this->file);
// empty file
if (null === $this->classes) {
View
2  src/Symfony/Component/Yaml/Inline.php
@@ -26,7 +26,7 @@ class Inline
*
* @return array A PHP array representing the YAML string
*/
- static public function load($value)
+ static public function parse($value)
{
$value = trim($value);
View
4 src/Symfony/Component/Yaml/Parser.php
@@ -168,7 +168,7 @@ public function parse($value)
} else {
// 1-liner followed by newline
if (2 == count($this->lines) && empty($this->lines[1])) {
- $value = Inline::load($this->lines[0]);
+ $value = Inline::parse($this->lines[0]);
if (is_array($value)) {
$first = reset($value);
if (is_string($first) && '*' === substr($first, 0, 1)) {
@@ -350,7 +350,7 @@ private function parseValue($value)
return $this->parseFoldedScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), intval(abs($modifiers)));
}
- return Inline::load($value);
+ return Inline::parse($value);
}
/**
View
8 src/Symfony/Component/Yaml/Yaml.php
@@ -49,14 +49,14 @@ static public function getSpecVersion()
}
/**
- * Loads YAML into a PHP array.
+ * Parses YAML into a PHP array.
*
- * The load method, when supplied with a YAML stream (string or file),
+ * The parse method, when supplied with a YAML stream (string or file),
* will do its best to convert YAML in a file into a PHP array.
*
* Usage:
* <code>
- * $array = Yaml::load('config.yml');
+ * $array = Yaml::parse('config.yml');
* print_r($array);
* </code>
*
@@ -68,7 +68,7 @@ static public function getSpecVersion()
*
* @api
*/
- static public function load($input)
+ static public function parse($input)
{
$file = '';
View
14 tests/Symfony/Tests/Component/Yaml/InlineTest.php
@@ -21,10 +21,10 @@ static public function setUpBeforeClass()
Yaml::setSpecVersion('1.1');
}
- public function testLoad()
+ public function testParse()
{
- foreach ($this->getTestsForLoad() as $yaml => $value) {
- $this->assertEquals($value, Inline::load($yaml), sprintf('::load() converts an inline YAML to a PHP structure (%s)', $yaml));
+ foreach ($this->getTestsForParse() as $yaml => $value) {
+ $this->assertEquals($value, Inline::parse($yaml), sprintf('::parse() converts an inline YAML to a PHP structure (%s)', $yaml));
}
}
@@ -36,12 +36,12 @@ public function testDump()
$this->assertEquals($yaml, Inline::dump($value), sprintf('::dump() converts a PHP structure to an inline YAML (%s)', $yaml));
}
- foreach ($this->getTestsForLoad() as $yaml => $value) {
+ foreach ($this->getTestsForParse() as $yaml => $value) {
if ($value == 1230) {
continue;
}
- $this->assertEquals($value, Inline::load(Inline::dump($value)), 'check consistency');
+ $this->assertEquals($value, Inline::parse(Inline::dump($value)), 'check consistency');
}
foreach ($testsForDump as $yaml => $value) {
@@ -49,11 +49,11 @@ public function testDump()
continue;
}
- $this->assertEquals($value, Inline::load(Inline::dump($value)), 'check consistency');
+ $this->assertEquals($value, Inline::parse(Inline::dump($value)), 'check consistency');
}
}
- protected function getTestsForLoad()
+ protected function getTestsForParse()
{
return array(
'' => '',
Please sign in to comment.
Something went wrong with that request. Please try again.