Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit df130a3

Browse filesBrowse files
committed
minor #20388 [Yaml] Clean some messages + add test case (nicolas-grekas)
This PR was merged into the 2.7 branch. Discussion ---------- [Yaml] Clean some messages + add test case | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Related to #20335 on 3.2. Commits ------- 7520f7b [Yaml] Clean some messages + add test case
2 parents 620ea20 + 7520f7b commit df130a3
Copy full SHA for df130a3

File tree

2 files changed

+13
-4
lines changed
Filter options

2 files changed

+13
-4
lines changed

‎src/Symfony/Component/Yaml/Inline.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Inline.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter
249249
$output = $match[1];
250250
$i += strlen($output);
251251
} else {
252-
throw new ParseException(sprintf('Malformed inline YAML string (%s).', $scalar));
252+
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $scalar));
253253
}
254254

255255
if ($evaluate) {
@@ -273,7 +273,7 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter
273273
private static function parseQuotedScalar($scalar, &$i)
274274
{
275275
if (!preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) {
276-
throw new ParseException(sprintf('Malformed inline YAML string (%s).', substr($scalar, $i)));
276+
throw new ParseException(sprintf('Malformed inline YAML string: %s.', substr($scalar, $i)));
277277
}
278278

279279
$output = substr($match[0], 1, strlen($match[0]) - 2);
@@ -346,7 +346,7 @@ private static function parseSequence($sequence, &$i = 0, $references = array())
346346
++$i;
347347
}
348348

349-
throw new ParseException(sprintf('Malformed inline YAML string %s', $sequence));
349+
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $sequence));
350350
}
351351

352352
/**
@@ -434,7 +434,7 @@ private static function parseMapping($mapping, &$i = 0, $references = array())
434434
}
435435
}
436436

437-
throw new ParseException(sprintf('Malformed inline YAML string %s', $mapping));
437+
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $mapping));
438438
}
439439

440440
/**

‎src/Symfony/Component/Yaml/Tests/InlineTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/InlineTest.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,4 +401,13 @@ public function getTestsForDump()
401401
array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))),
402402
);
403403
}
404+
405+
/**
406+
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
407+
* @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported}.
408+
*/
409+
public function testNotSupportedMissingValue()
410+
{
411+
Inline::parse('{this, is not, supported}');
412+
}
404413
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.