Skip to content

Commit

Permalink
minor #14412 [Yaml] Match signature of Yaml::parse() with Parser->par…
Browse files Browse the repository at this point in the history
…se() (Zzortell)

This PR was merged into the 2.7 branch.

Discussion
----------

[Yaml] Match signature of Yaml::parse() with Parser->parse()

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

238589d Add $objectForMap as argument of Yaml::parse()
  • Loading branch information
fabpot committed Apr 27, 2015
2 parents 501df8d + 238589d commit 3a404f8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Symfony/Component/Yaml/Yaml.php
Expand Up @@ -41,6 +41,7 @@ class Yaml
* @param string $input Path to a YAML file or 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
* @param bool $objectForMap True if maps should return a stdClass instead of array()
*
* @return array The YAML converted to a PHP array
*
Expand All @@ -50,7 +51,7 @@ class Yaml
*
* @api
*/
public static function parse($input, $exceptionOnInvalidType = false, $objectSupport = false)
public static function parse($input, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false)
{
// if input is a file, process it
$file = '';
Expand All @@ -68,7 +69,7 @@ public static function parse($input, $exceptionOnInvalidType = false, $objectSup
$yaml = new Parser();

try {
return $yaml->parse($input, $exceptionOnInvalidType, $objectSupport);
return $yaml->parse($input, $exceptionOnInvalidType, $objectSupport, $objectForMap);
} catch (ParseException $e) {
if ($file) {
$e->setParsedFile($file);
Expand Down

0 comments on commit 3a404f8

Please sign in to comment.