[Yaml] fixed unneeded BC break
This commit is contained in:
parent
972e1b7a16
commit
0138c2d0b3
@ -40,13 +40,13 @@ class Dumper
|
||||
*
|
||||
* @param mixed $input The PHP value
|
||||
* @param integer $inline The level where you switch to inline YAML
|
||||
* @param integer $indent The level of indentation (used internally)
|
||||
* @param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
|
||||
* @param Boolean $objectSupport true if object support is enabled, false otherwise
|
||||
* @param integer $indent The level of indentation (used internally)
|
||||
*
|
||||
* @return string The YAML representation of the PHP value
|
||||
*/
|
||||
public function dump($input, $inline = 0, $exceptionOnInvalidType = false, $objectSupport = false, $indent = 0)
|
||||
public function dump($input, $inline = 0, $indent = 0, $exceptionOnInvalidType = false, $objectSupport = false)
|
||||
{
|
||||
$output = '';
|
||||
$prefix = $indent ? str_repeat(' ', $indent) : '';
|
||||
@ -63,7 +63,7 @@ class Dumper
|
||||
$prefix,
|
||||
$isAHash ? Inline::dump($key, $exceptionOnInvalidType, $objectSupport).':' : '-',
|
||||
$willBeInlined ? ' ' : "\n",
|
||||
$this->dump($value, $inline - 1, $exceptionOnInvalidType, $objectSupport, $willBeInlined ? 0 : $indent + $this->indentation)
|
||||
$this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $exceptionOnInvalidType, $objectSupport)
|
||||
).($willBeInlined ? "\n" : '');
|
||||
}
|
||||
}
|
||||
|
@ -150,6 +150,6 @@ class Yaml
|
||||
$yaml = new Dumper();
|
||||
$yaml->setIndentation($indent);
|
||||
|
||||
return $yaml->dump($array, $inline, $exceptionOnInvalidType, $objectSupport);
|
||||
return $yaml->dump($array, $inline, 0, $exceptionOnInvalidType, $objectSupport);
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ EOF;
|
||||
|
||||
public function testObjectSupportEnabled()
|
||||
{
|
||||
$dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, false, true);
|
||||
$dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, false, true);
|
||||
|
||||
$this->assertEquals('{ foo: !!php/object:O:30:"Symfony\Tests\Component\Yaml\A":1:{s:1:"a";s:3:"foo";}, bar: 1 }', $dump, '->dump() is able to dump objects');
|
||||
}
|
||||
@ -171,7 +171,7 @@ EOF;
|
||||
*/
|
||||
public function testObjectSupportDisabledWithExceptions()
|
||||
{
|
||||
$this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, true, false);
|
||||
$this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user