Skip to content

Commit b0b2ddc

Browse files
committed
Merge branch '3.0'
* 3.0: [Form] [ChoiceType] Prefer placeholder to empty_value Add missing RFC comment ensure dump indentation to be greather than zero
2 parents 11e1aa8 + dc15374 commit b0b2ddc

File tree

5 files changed

+42
-2
lines changed

5 files changed

+42
-2
lines changed

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

Lines 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

Lines 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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class Dumper
3030
*/
3131
public function __construct($indentation = 4)
3232
{
33+
if ($indentation < 1) {
34+
throw new \InvalidArgumentException('The indentation must be greater than zero.');
35+
}
36+
3337
$this->indentation = $indentation;
3438
}
3539

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,24 @@ public function testDumpMultiLineStringAsScalarBlock()
347347

348348
$this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block.yml'), $this->dumper->dump($data, 3, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
349349
}
350+
351+
/**
352+
* @expectedException \InvalidArgumentException
353+
* @expectedExceptionMessage The indentation must be greater than zero
354+
*/
355+
public function testZeroIndentationThrowsException()
356+
{
357+
new Dumper(0);
358+
}
359+
360+
/**
361+
* @expectedException \InvalidArgumentException
362+
* @expectedExceptionMessage The indentation must be greater than zero
363+
*/
364+
public function testNegativeIndentationThrowsException()
365+
{
366+
new Dumper(-4);
367+
}
350368
}
351369

352370
class A

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

Lines 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
}

0 commit comments

Comments
 (0)