Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dc15374

Browse filesBrowse files
committed
Merge branch '2.8' into 3.0
* 2.8: [Form] [ChoiceType] Prefer placeholder to empty_value Add missing RFC comment ensure dump indentation to be greather than zero
2 parents 3a07636 + fdabbaa commit dc15374
Copy full SHA for dc15374

File tree

Expand file treeCollapse file tree

6 files changed

+46
-2
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+46
-2
lines changed

‎src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ public function testPassPlaceholderToView($multiple, $expanded, $required, $plac
14351435
));
14361436
$view = $form->createView();
14371437

1438-
$this->assertEquals($viewValue, $view->vars['placeholder']);
1438+
$this->assertSame($viewValue, $view->vars['placeholder']);
14391439
$this->assertFalse($view->vars['placeholder_in_choices']);
14401440
}
14411441

‎src/Symfony/Component/HttpFoundation/Response.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Response.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class Response
170170
428 => 'Precondition Required', // RFC6585
171171
429 => 'Too Many Requests', // RFC6585
172172
431 => 'Request Header Fields Too Large', // RFC6585
173-
451 => 'Unavailable For Legal Reasons',
173+
451 => 'Unavailable For Legal Reasons', // RFC7725
174174
500 => 'Internal Server Error',
175175
501 => 'Not Implemented',
176176
502 => 'Bad Gateway',

‎src/Symfony/Component/Yaml/Dumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Dumper.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ class Dumper
3232
*/
3333
public function setIndentation($num)
3434
{
35+
if ($num < 1) {
36+
throw new \InvalidArgumentException('The indentation must be greater than zero.');
37+
}
38+
3539
$this->indentation = (int) $num;
3640
}
3741

‎src/Symfony/Component/Yaml/Tests/DumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/DumperTest.php
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,24 @@ public function getEscapeSequences()
228228
'paragraph-separator' => array("\t\\P", '"\t\\\\P"'),
229229
);
230230
}
231+
232+
/**
233+
* @expectedException \InvalidArgumentException
234+
* @expectedExceptionMessage The indentation must be greater than zero
235+
*/
236+
public function testZeroIndentationThrowsException()
237+
{
238+
$this->dumper->setIndentation(0);
239+
}
240+
241+
/**
242+
* @expectedException \InvalidArgumentException
243+
* @expectedExceptionMessage The indentation must be greater than zero
244+
*/
245+
public function testNegativeIndentationThrowsException()
246+
{
247+
$this->dumper->setIndentation(-4);
248+
}
231249
}
232250

233251
class A

‎src/Symfony/Component/Yaml/Tests/YamlTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/YamlTest.php
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,22 @@ public function testParseAndDump()
2222
$parsed = Yaml::parse($yml);
2323
$this->assertEquals($data, $parsed);
2424
}
25+
26+
/**
27+
* @expectedException \InvalidArgumentException
28+
* @expectedExceptionMessage The indentation must be greater than zero
29+
*/
30+
public function testZeroIndentationThrowsException()
31+
{
32+
Yaml::dump(array('lorem' => 'ipsum', 'dolor' => 'sit'), 2, 0);
33+
}
34+
35+
/**
36+
* @expectedException \InvalidArgumentException
37+
* @expectedExceptionMessage The indentation must be greater than zero
38+
*/
39+
public function testNegativeIndentationThrowsException()
40+
{
41+
Yaml::dump(array('lorem' => 'ipsum', 'dolor' => 'sit'), 2, -4);
42+
}
2543
}

‎src/Symfony/Component/Yaml/Yaml.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Yaml.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ public static function parse($input, $exceptionOnInvalidType = false, $objectSup
6161
*/
6262
public static function dump($array, $inline = 2, $indent = 4, $exceptionOnInvalidType = false, $objectSupport = false)
6363
{
64+
if ($indent < 1) {
65+
throw new \InvalidArgumentException('The indentation must be greater than zero.');
66+
}
67+
6468
$yaml = new Dumper();
6569
$yaml->setIndentation($indent);
6670

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.