Skip to content

Commit 43d7a46

Browse files
committed
Merge branch '3.4' into 4.4
* 3.4: Fix quotes in exception messages
2 parents 5342b6f + 688cfb1 commit 43d7a46

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
@@ -297,7 +297,7 @@ public static function parseScalar(string $scalar, int $flags = 0, array $delimi
297297
$i += \strlen($output);
298298
$output = trim($output);
299299
} else {
300-
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename);
300+
throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename);
301301
}
302302

303303
// a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >)
@@ -321,7 +321,7 @@ public static function parseScalar(string $scalar, int $flags = 0, array $delimi
321321
private static function parseQuotedScalar(string $scalar, int &$i): string
322322
{
323323
if (!Parser::preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) {
324-
throw new ParseException(sprintf('Malformed inline YAML string: %s.', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
324+
throw new ParseException(sprintf('Malformed inline YAML string: "%s".', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
325325
}
326326

327327
$output = substr($match[0], 1, \strlen($match[0]) - 2);
@@ -397,7 +397,7 @@ private static function parseSequence(string $sequence, int $flags, int &$i = 0,
397397
++$i;
398398
}
399399

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

403403
/**
@@ -538,7 +538,7 @@ private static function parseMapping(string $mapping, int $flags, int &$i = 0, a
538538
}
539539
}
540540

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

544544
/**

Tests/InlineTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ public function getInvalidBinaryData()
617617
public function testNotSupportedMissingValue()
618618
{
619619
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
620-
$this->expectExceptionMessage('Malformed inline YAML string: {this, is not, supported} at line 1.');
620+
$this->expectExceptionMessage('Malformed inline YAML string: "{this, is not, supported}" at line 1.');
621621
Inline::parse('{this, is not, supported}');
622622
}
623623

0 commit comments

Comments
 (0)