Skip to content

Commit

Permalink
Merge branch '3.4' into 4.4
Browse files Browse the repository at this point in the history
* 3.4:
  Fix quotes in exception messages
  • Loading branch information
fabpot committed Mar 16, 2020
2 parents 5342b6f + 688cfb1 commit 43d7a46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public static function parseScalar(string $scalar, int $flags = 0, array $delimi
$i += \strlen($output);
$output = trim($output);
} else {
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename);
throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename);
}

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

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

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

/**
Expand Down Expand Up @@ -538,7 +538,7 @@ private static function parseMapping(string $mapping, int $flags, int &$i = 0, a
}
}

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

/**
Expand Down
2 changes: 1 addition & 1 deletion Tests/InlineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ public function getInvalidBinaryData()
public function testNotSupportedMissingValue()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessage('Malformed inline YAML string: {this, is not, supported} at line 1.');
$this->expectExceptionMessage('Malformed inline YAML string: "{this, is not, supported}" at line 1.');
Inline::parse('{this, is not, supported}');
}

Expand Down

0 comments on commit 43d7a46

Please sign in to comment.