Skip to content

Commit b2010d5

Browse files
erge branch '3.1'
* 3.1: Remove trailing space CS fixes Remove trailing space CS: apply rules [Yaml] Clean some messages + add test case [Console] simplified code [Form] Fix UrlType transforms valid protocols [SecurityBundle] Changed encoder configuration example to bcrypt
2 parents fc738a6 + 9f95e4a commit b2010d5

File tree

3 files changed

+39
-39
lines changed

3 files changed

+39
-39
lines changed

Inline.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public static function parseScalar($scalar, $flags = 0, $delimiters = null, $str
313313
$output = $match[1];
314314
$i += strlen($output);
315315
} else {
316-
throw new ParseException(sprintf('Malformed inline YAML string (%s).', $scalar));
316+
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $scalar));
317317
}
318318

319319
// a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >)
@@ -346,7 +346,7 @@ public static function parseScalar($scalar, $flags = 0, $delimiters = null, $str
346346
private static function parseQuotedScalar($scalar, &$i)
347347
{
348348
if (!preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) {
349-
throw new ParseException(sprintf('Malformed inline YAML string (%s).', substr($scalar, $i)));
349+
throw new ParseException(sprintf('Malformed inline YAML string: %s.', substr($scalar, $i)));
350350
}
351351

352352
$output = substr($match[0], 1, strlen($match[0]) - 2);
@@ -420,7 +420,7 @@ private static function parseSequence($sequence, $flags, &$i = 0, $references =
420420
++$i;
421421
}
422422

423-
throw new ParseException(sprintf('Malformed inline YAML string %s', $sequence));
423+
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $sequence));
424424
}
425425

426426
/**
@@ -523,7 +523,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
523523
}
524524
}
525525

526-
throw new ParseException(sprintf('Malformed inline YAML string %s', $mapping));
526+
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $mapping));
527527
}
528528

529529
/**

Tests/InlineTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,10 @@ public function getInvalidBinaryData()
657657

658658
/**
659659
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
660-
* @expectedExceptionMessage Malformed inline YAML string {this, is not, yaml}
660+
* @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported}.
661661
*/
662-
public function testStringOffsetCastError()
662+
public function testNotSupportedMissingValue()
663663
{
664-
Inline::parse('{this, is not, yaml}');
664+
Inline::parse('{this, is not, supported}');
665665
}
666666
}

Tests/ParserTest.php

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ public function testBlockLiteralWithLeadingNewlines()
442442

443443
public function testObjectSupportEnabled()
444444
{
445-
$input = <<<EOF
445+
$input = <<<'EOF'
446446
foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
447447
bar: 1
448448
EOF;
@@ -454,7 +454,7 @@ public function testObjectSupportEnabled()
454454
*/
455455
public function testObjectSupportEnabledPassingTrue()
456456
{
457-
$input = <<<EOF
457+
$input = <<<'EOF'
458458
foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
459459
bar: 1
460460
EOF;
@@ -466,7 +466,7 @@ public function testObjectSupportEnabledPassingTrue()
466466
*/
467467
public function testObjectSupportEnabledWithDeprecatedTag()
468468
{
469-
$input = <<<EOF
469+
$input = <<<'EOF'
470470
foo: !!php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
471471
bar: 1
472472
EOF;
@@ -502,7 +502,7 @@ public function getObjectForMapTests()
502502
{
503503
$tests = array();
504504

505-
$yaml = <<<EOF
505+
$yaml = <<<'EOF'
506506
foo:
507507
fiz: [cat]
508508
EOF;
@@ -523,7 +523,7 @@ public function getObjectForMapTests()
523523
$expected->baz = 'foobar';
524524
$tests['object-for-map-is-applied-after-parsing'] = array($yaml, $expected);
525525

526-
$yaml = <<<EOT
526+
$yaml = <<<'EOT'
527527
array:
528528
- key: one
529529
- key: two
@@ -536,7 +536,7 @@ public function getObjectForMapTests()
536536
$expected->array[1]->key = 'two';
537537
$tests['nest-map-and-sequence'] = array($yaml, $expected);
538538

539-
$yaml = <<<YAML
539+
$yaml = <<<'YAML'
540540
map:
541541
1: one
542542
2: two
@@ -547,7 +547,7 @@ public function getObjectForMapTests()
547547
$expected->map->{2} = 'two';
548548
$tests['numeric-keys'] = array($yaml, $expected);
549549

550-
$yaml = <<<YAML
550+
$yaml = <<<'YAML'
551551
map:
552552
0: one
553553
1: two
@@ -582,11 +582,11 @@ public function testObjectsSupportDisabledWithExceptionsUsingBooleanToggles($yam
582582

583583
public function invalidDumpedObjectProvider()
584584
{
585-
$yamlTag = <<<EOF
585+
$yamlTag = <<<'EOF'
586586
foo: !!php/object:O:30:"Symfony\Tests\Component\Yaml\B":1:{s:1:"b";s:3:"foo";}
587587
bar: 1
588588
EOF;
589-
$localTag = <<<EOF
589+
$localTag = <<<'EOF'
590590
foo: !php/object:O:30:"Symfony\Tests\Component\Yaml\B":1:{s:1:"b";s:3:"foo";}
591591
bar: 1
592592
EOF;
@@ -688,7 +688,7 @@ public function testSequenceInAMapping()
688688

689689
public function testSequenceInMappingStartedBySingleDashLine()
690690
{
691-
$yaml = <<<EOT
691+
$yaml = <<<'EOT'
692692
a:
693693
-
694694
b:
@@ -716,7 +716,7 @@ public function testSequenceInMappingStartedBySingleDashLine()
716716

717717
public function testSequenceFollowedByCommentEmbeddedInMapping()
718718
{
719-
$yaml = <<<EOT
719+
$yaml = <<<'EOT'
720720
a:
721721
b:
722722
- c
@@ -752,7 +752,7 @@ public function testMappingInASequence()
752752
*/
753753
public function testScalarInSequence()
754754
{
755-
Yaml::parse(<<<EOF
755+
Yaml::parse(<<<'EOF'
756756
foo:
757757
- bar
758758
"missing colon"
@@ -774,7 +774,7 @@ public function testScalarInSequence()
774774
*/
775775
public function testMappingDuplicateKeyBlock()
776776
{
777-
$input = <<<EOD
777+
$input = <<<'EOD'
778778
parent:
779779
child: first
780780
child: duplicate
@@ -795,7 +795,7 @@ public function testMappingDuplicateKeyBlock()
795795
*/
796796
public function testMappingDuplicateKeyFlow()
797797
{
798-
$input = <<<EOD
798+
$input = <<<'EOD'
799799
parent: { child: first, child: duplicate }
800800
parent: { child: duplicate, child: duplicate }
801801
EOD;
@@ -1060,7 +1060,7 @@ public function testFloatKeys()
10601060
*/
10611061
public function testColonInMappingValueException()
10621062
{
1063-
$yaml = <<<EOF
1063+
$yaml = <<<'EOF'
10641064
foo: bar: baz
10651065
EOF;
10661066

@@ -1069,7 +1069,7 @@ public function testColonInMappingValueException()
10691069

10701070
public function testColonInMappingValueExceptionNotTriggeredByColonInComment()
10711071
{
1072-
$yaml = <<<EOT
1072+
$yaml = <<<'EOT'
10731073
foo:
10741074
bar: foobar # Note: a comment after a colon
10751075
EOT;
@@ -1170,7 +1170,7 @@ public function getCommentLikeStringInScalarBlockData()
11701170
);
11711171
$tests[] = array($yaml, $expected);
11721172

1173-
$yaml = <<<EOT
1173+
$yaml = <<<'EOT'
11741174
foo:
11751175
bar:
11761176
scalar-block: >
@@ -1213,7 +1213,7 @@ public function getCommentLikeStringInScalarBlockData()
12131213

12141214
public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks()
12151215
{
1216-
$yaml = <<<EOT
1216+
$yaml = <<<'EOT'
12171217
test: >
12181218
<h2>A heading</h2>
12191219
@@ -1225,7 +1225,7 @@ public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks()
12251225

12261226
$this->assertSame(
12271227
array(
1228-
'test' => <<<EOT
1228+
'test' => <<<'EOT'
12291229
<h2>A heading</h2>
12301230
<ul> <li>a list</li> <li>may be a good example</li> </ul>
12311231
EOT
@@ -1237,7 +1237,7 @@ public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks()
12371237

12381238
public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks()
12391239
{
1240-
$yaml = <<<EOT
1240+
$yaml = <<<'EOT'
12411241
test: >
12421242
<h2>A heading</h2>
12431243
@@ -1249,7 +1249,7 @@ public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks()
12491249

12501250
$this->assertSame(
12511251
array(
1252-
'test' => <<<EOT
1252+
'test' => <<<'EOT'
12531253
<h2>A heading</h2>
12541254
<ul>
12551255
<li>a list</li>
@@ -1277,13 +1277,13 @@ public function getBinaryData()
12771277
'enclosed with single quotes' => array("data: !!binary 'SGVsbG8gd29ybGQ='"),
12781278
'containing spaces' => array('data: !!binary "SGVs bG8gd 29ybGQ="'),
12791279
'in block scalar' => array(
1280-
<<<EOT
1280+
<<<'EOT'
12811281
data: !!binary |
12821282
SGVsbG8gd29ybGQ=
12831283
EOT
12841284
),
12851285
'containing spaces in block scalar' => array(
1286-
<<<EOT
1286+
<<<'EOT'
12871287
data: !!binary |
12881288
SGVs bG8gd 29ybGQ=
12891289
EOT
@@ -1309,31 +1309,31 @@ public function getInvalidBinaryData()
13091309
'too many equals characters' => array('data: !!binary "SGVsbG8gd29yb==="', '/The base64 encoded data \(.*\) contains invalid characters/'),
13101310
'misplaced equals character' => array('data: !!binary "SGVsbG8gd29ybG=Q"', '/The base64 encoded data \(.*\) contains invalid characters/'),
13111311
'length not a multiple of four in block scalar' => array(
1312-
<<<EOT
1312+
<<<'EOT'
13131313
data: !!binary |
13141314
SGVsbG8d29ybGQ=
13151315
EOT
13161316
,
13171317
'/The normalized base64 encoded data \(data without whitespace characters\) length must be a multiple of four \(\d+ bytes given\)/',
13181318
),
13191319
'invalid characters in block scalar' => array(
1320-
<<<EOT
1320+
<<<'EOT'
13211321
data: !!binary |
13221322
SGVsbG8#d29ybGQ=
13231323
EOT
13241324
,
13251325
'/The base64 encoded data \(.*\) contains invalid characters/',
13261326
),
13271327
'too many equals characters in block scalar' => array(
1328-
<<<EOT
1328+
<<<'EOT'
13291329
data: !!binary |
13301330
SGVsbG8gd29yb===
13311331
EOT
13321332
,
13331333
'/The base64 encoded data \(.*\) contains invalid characters/',
13341334
),
13351335
'misplaced equals character in block scalar' => array(
1336-
<<<EOT
1336+
<<<'EOT'
13371337
data: !!binary |
13381338
SGVsbG8gd29ybG=Q
13391339
EOT
@@ -1345,7 +1345,7 @@ public function getInvalidBinaryData()
13451345

13461346
public function testParseDateAsMappingValue()
13471347
{
1348-
$yaml = <<<EOT
1348+
$yaml = <<<'EOT'
13491349
date: 2002-12-14
13501350
EOT;
13511351
$expectedDate = new \DateTime();
@@ -1376,7 +1376,7 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider()
13761376
return array(
13771377
array(
13781378
4,
1379-
<<<YAML
1379+
<<<'YAML'
13801380
foo:
13811381
-
13821382
# bar
@@ -1385,7 +1385,7 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider()
13851385
),
13861386
array(
13871387
5,
1388-
<<<YAML
1388+
<<<'YAML'
13891389
foo:
13901390
-
13911391
# bar
@@ -1395,7 +1395,7 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider()
13951395
),
13961396
array(
13971397
8,
1398-
<<<YAML
1398+
<<<'YAML'
13991399
foo:
14001400
-
14011401
# foobar
@@ -1408,7 +1408,7 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider()
14081408
),
14091409
array(
14101410
10,
1411-
<<<YAML
1411+
<<<'YAML'
14121412
foo:
14131413
-
14141414
# foobar

0 commit comments

Comments
 (0)