Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0138c2d

Browse files
committed
[Yaml] fixed unneeded BC break
1 parent 972e1b7 commit 0138c2d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Symfony/Component/Yaml/Dumper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ public function setIndentation($num)
4040
*
4141
* @param mixed $input The PHP value
4242
* @param integer $inline The level where you switch to inline YAML
43+
* @param integer $indent The level of indentation (used internally)
4344
* @param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
4445
* @param Boolean $objectSupport true if object support is enabled, false otherwise
45-
* @param integer $indent The level of indentation (used internally)
4646
*
4747
* @return string The YAML representation of the PHP value
4848
*/
49-
public function dump($input, $inline = 0, $exceptionOnInvalidType = false, $objectSupport = false, $indent = 0)
49+
public function dump($input, $inline = 0, $indent = 0, $exceptionOnInvalidType = false, $objectSupport = false)
5050
{
5151
$output = '';
5252
$prefix = $indent ? str_repeat(' ', $indent) : '';
@@ -63,7 +63,7 @@ public function dump($input, $inline = 0, $exceptionOnInvalidType = false, $obje
6363
$prefix,
6464
$isAHash ? Inline::dump($key, $exceptionOnInvalidType, $objectSupport).':' : '-',
6565
$willBeInlined ? ' ' : "\n",
66-
$this->dump($value, $inline - 1, $exceptionOnInvalidType, $objectSupport, $willBeInlined ? 0 : $indent + $this->indentation)
66+
$this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $exceptionOnInvalidType, $objectSupport)
6767
).($willBeInlined ? "\n" : '');
6868
}
6969
}

src/Symfony/Component/Yaml/Yaml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,6 @@ public static function dump($array, $inline = 2, $indent = 2, $exceptionOnInvali
150150
$yaml = new Dumper();
151151
$yaml->setIndentation($indent);
152152

153-
return $yaml->dump($array, $inline, $exceptionOnInvalidType, $objectSupport);
153+
return $yaml->dump($array, $inline, 0, $exceptionOnInvalidType, $objectSupport);
154154
}
155155
}

tests/Symfony/Tests/Component/Yaml/DumperTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function testInlineLevel()
154154

155155
public function testObjectSupportEnabled()
156156
{
157-
$dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, false, true);
157+
$dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, false, true);
158158

159159
$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');
160160
}
@@ -171,7 +171,7 @@ public function testObjectSupportDisabledButNoExceptions()
171171
*/
172172
public function testObjectSupportDisabledWithExceptions()
173173
{
174-
$this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, true, false);
174+
$this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, true, false);
175175
}
176176
}
177177

0 commit comments

Comments
 (0)