Skip to content

Commit 58666e4

Browse files
Merge branch '2.7' into 2.8
* 2.7: CS fixes Remove trailing space CS: apply rules [Yaml] Clean some messages + add test case [Form] Fix UrlType transforms valid protocols [SecurityBundle] Changed encoder configuration example to bcrypt
2 parents 396784c + cf51568 commit 58666e4

File tree

3 files changed

+37
-28
lines changed

3 files changed

+37
-28
lines changed

Inline.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter
251251
$output = $match[1];
252252
$i += strlen($output);
253253
} else {
254-
throw new ParseException(sprintf('Malformed inline YAML string (%s).', $scalar));
254+
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $scalar));
255255
}
256256

257257
// a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >)
@@ -283,7 +283,7 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter
283283
private static function parseQuotedScalar($scalar, &$i)
284284
{
285285
if (!preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) {
286-
throw new ParseException(sprintf('Malformed inline YAML string (%s).', substr($scalar, $i)));
286+
throw new ParseException(sprintf('Malformed inline YAML string: %s.', substr($scalar, $i)));
287287
}
288288

289289
$output = substr($match[0], 1, strlen($match[0]) - 2);
@@ -356,7 +356,7 @@ private static function parseSequence($sequence, &$i = 0, $references = array())
356356
++$i;
357357
}
358358

359-
throw new ParseException(sprintf('Malformed inline YAML string %s', $sequence));
359+
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $sequence));
360360
}
361361

362362
/**
@@ -444,7 +444,7 @@ private static function parseMapping($mapping, &$i = 0, $references = array())
444444
}
445445
}
446446

447-
throw new ParseException(sprintf('Malformed inline YAML string %s', $mapping));
447+
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $mapping));
448448
}
449449

450450
/**

Tests/InlineTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,4 +448,13 @@ public function getTestsForDump()
448448
array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))),
449449
);
450450
}
451+
452+
/**
453+
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
454+
* @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported}.
455+
*/
456+
public function testNotSupportedMissingValue()
457+
{
458+
Inline::parse('{this, is not, supported}');
459+
}
451460
}

Tests/ParserTest.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,13 @@ public function testBlockLiteralWithLeadingNewlines()
421421

422422
public function testObjectSupportEnabled()
423423
{
424-
$input = <<<EOF
424+
$input = <<<'EOF'
425425
foo: !!php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
426426
bar: 1
427427
EOF;
428428
$this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($input, false, true), '->parse() is able to parse objects');
429429

430-
$input = <<<EOF
430+
$input = <<<'EOF'
431431
foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
432432
bar: 1
433433
EOF;
@@ -454,7 +454,7 @@ public function getObjectForMapTests()
454454
{
455455
$tests = array();
456456

457-
$yaml = <<<EOF
457+
$yaml = <<<'EOF'
458458
foo:
459459
fiz: [cat]
460460
EOF;
@@ -475,7 +475,7 @@ public function getObjectForMapTests()
475475
$expected->baz = 'foobar';
476476
$tests['object-for-map-is-applied-after-parsing'] = array($yaml, $expected);
477477

478-
$yaml = <<<EOT
478+
$yaml = <<<'EOT'
479479
array:
480480
- key: one
481481
- key: two
@@ -488,7 +488,7 @@ public function getObjectForMapTests()
488488
$expected->array[1]->key = 'two';
489489
$tests['nest-map-and-sequence'] = array($yaml, $expected);
490490

491-
$yaml = <<<YAML
491+
$yaml = <<<'YAML'
492492
map:
493493
1: one
494494
2: two
@@ -499,7 +499,7 @@ public function getObjectForMapTests()
499499
$expected->map->{2} = 'two';
500500
$tests['numeric-keys'] = array($yaml, $expected);
501501

502-
$yaml = <<<YAML
502+
$yaml = <<<'YAML'
503503
map:
504504
0: one
505505
1: two
@@ -524,11 +524,11 @@ public function testObjectsSupportDisabledWithExceptions($yaml)
524524

525525
public function invalidDumpedObjectProvider()
526526
{
527-
$yamlTag = <<<EOF
527+
$yamlTag = <<<'EOF'
528528
foo: !!php/object:O:30:"Symfony\Tests\Component\Yaml\B":1:{s:1:"b";s:3:"foo";}
529529
bar: 1
530530
EOF;
531-
$localTag = <<<EOF
531+
$localTag = <<<'EOF'
532532
foo: !php/object:O:30:"Symfony\Tests\Component\Yaml\B":1:{s:1:"b";s:3:"foo";}
533533
bar: 1
534534
EOF;
@@ -630,7 +630,7 @@ public function testSequenceInAMapping()
630630

631631
public function testSequenceInMappingStartedBySingleDashLine()
632632
{
633-
$yaml = <<<EOT
633+
$yaml = <<<'EOT'
634634
a:
635635
-
636636
b:
@@ -658,7 +658,7 @@ public function testSequenceInMappingStartedBySingleDashLine()
658658

659659
public function testSequenceFollowedByCommentEmbeddedInMapping()
660660
{
661-
$yaml = <<<EOT
661+
$yaml = <<<'EOT'
662662
a:
663663
b:
664664
- c
@@ -694,7 +694,7 @@ public function testMappingInASequence()
694694
*/
695695
public function testScalarInSequence()
696696
{
697-
Yaml::parse(<<<EOF
697+
Yaml::parse(<<<'EOF'
698698
foo:
699699
- bar
700700
"missing colon"
@@ -715,7 +715,7 @@ public function testScalarInSequence()
715715
*/
716716
public function testMappingDuplicateKeyBlock()
717717
{
718-
$input = <<<EOD
718+
$input = <<<'EOD'
719719
parent:
720720
child: first
721721
child: duplicate
@@ -733,7 +733,7 @@ public function testMappingDuplicateKeyBlock()
733733

734734
public function testMappingDuplicateKeyFlow()
735735
{
736-
$input = <<<EOD
736+
$input = <<<'EOD'
737737
parent: { child: first, child: duplicate }
738738
parent: { child: duplicate, child: duplicate }
739739
EOD;
@@ -931,7 +931,7 @@ public function testFloatKeys()
931931
*/
932932
public function testColonInMappingValueException()
933933
{
934-
$yaml = <<<EOF
934+
$yaml = <<<'EOF'
935935
foo: bar: baz
936936
EOF;
937937

@@ -940,7 +940,7 @@ public function testColonInMappingValueException()
940940

941941
public function testColonInMappingValueExceptionNotTriggeredByColonInComment()
942942
{
943-
$yaml = <<<EOT
943+
$yaml = <<<'EOT'
944944
foo:
945945
bar: foobar # Note: a comment after a colon
946946
EOT;
@@ -1041,7 +1041,7 @@ public function getCommentLikeStringInScalarBlockData()
10411041
);
10421042
$tests[] = array($yaml, $expected);
10431043

1044-
$yaml = <<<EOT
1044+
$yaml = <<<'EOT'
10451045
foo:
10461046
bar:
10471047
scalar-block: >
@@ -1084,7 +1084,7 @@ public function getCommentLikeStringInScalarBlockData()
10841084

10851085
public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks()
10861086
{
1087-
$yaml = <<<EOT
1087+
$yaml = <<<'EOT'
10881088
test: >
10891089
<h2>A heading</h2>
10901090
@@ -1096,7 +1096,7 @@ public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks()
10961096

10971097
$this->assertSame(
10981098
array(
1099-
'test' => <<<EOT
1099+
'test' => <<<'EOT'
11001100
<h2>A heading</h2>
11011101
<ul> <li>a list</li> <li>may be a good example</li> </ul>
11021102
EOT
@@ -1108,7 +1108,7 @@ public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks()
11081108

11091109
public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks()
11101110
{
1111-
$yaml = <<<EOT
1111+
$yaml = <<<'EOT'
11121112
test: >
11131113
<h2>A heading</h2>
11141114
@@ -1120,7 +1120,7 @@ public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks()
11201120

11211121
$this->assertSame(
11221122
array(
1123-
'test' => <<<EOT
1123+
'test' => <<<'EOT'
11241124
<h2>A heading</h2>
11251125
<ul>
11261126
<li>a list</li>
@@ -1153,7 +1153,7 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider()
11531153
return array(
11541154
array(
11551155
4,
1156-
<<<YAML
1156+
<<<'YAML'
11571157
foo:
11581158
-
11591159
# bar
@@ -1162,7 +1162,7 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider()
11621162
),
11631163
array(
11641164
5,
1165-
<<<YAML
1165+
<<<'YAML'
11661166
foo:
11671167
-
11681168
# bar
@@ -1172,7 +1172,7 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider()
11721172
),
11731173
array(
11741174
8,
1175-
<<<YAML
1175+
<<<'YAML'
11761176
foo:
11771177
-
11781178
# foobar
@@ -1185,7 +1185,7 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider()
11851185
),
11861186
array(
11871187
10,
1188-
<<<YAML
1188+
<<<'YAML'
11891189
foo:
11901190
-
11911191
# foobar

0 commit comments

Comments
 (0)