Skip to content

Commit 688cfb1

Browse files
committed
Fix quotes in exception messages
1 parent d54c2a8 commit 688cfb1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Inline.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i
347347
$output = $match[1];
348348
$i += \strlen($output);
349349
} else {
350-
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename);
350+
throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename);
351351
}
352352

353353
// a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >)
@@ -380,7 +380,7 @@ public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i
380380
private static function parseQuotedScalar($scalar, &$i)
381381
{
382382
if (!Parser::preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) {
383-
throw new ParseException(sprintf('Malformed inline YAML string: %s.', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
383+
throw new ParseException(sprintf('Malformed inline YAML string: "%s".', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
384384
}
385385

386386
$output = substr($match[0], 1, \strlen($match[0]) - 2);
@@ -463,7 +463,7 @@ private static function parseSequence($sequence, $flags, &$i = 0, $references =
463463
++$i;
464464
}
465465

466-
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $sequence), self::$parsedLineNumber + 1, null, self::$parsedFilename);
466+
throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $sequence), self::$parsedLineNumber + 1, null, self::$parsedFilename);
467467
}
468468

469469
/**
@@ -612,7 +612,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = []
612612
}
613613
}
614614

615-
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $mapping), self::$parsedLineNumber + 1, null, self::$parsedFilename);
615+
throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $mapping), self::$parsedLineNumber + 1, null, self::$parsedFilename);
616616
}
617617

618618
/**

Tests/InlineTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ public function getInvalidBinaryData()
693693
public function testNotSupportedMissingValue()
694694
{
695695
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
696-
$this->expectExceptionMessage('Malformed inline YAML string: {this, is not, supported} at line 1.');
696+
$this->expectExceptionMessage('Malformed inline YAML string: "{this, is not, supported}" at line 1.');
697697
Inline::parse('{this, is not, supported}');
698698
}
699699

0 commit comments

Comments
 (0)