Skip to content

Commit cc8ea7f

Browse files
committed
Merge branch '6.4' into 7.2
* 6.4: Review validator-related japanese translations with ids 114-120 don't trigger "internal" deprecations for PHPUnit Stub objects drop comments while lexing unquoted strings
2 parents 90f046f + 9832ffe commit cc8ea7f

File tree

4 files changed

+85
-9
lines changed

4 files changed

+85
-9
lines changed

src/Symfony/Component/ErrorHandler/DebugClassLoader.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Phake\IMock;
1919
use PHPUnit\Framework\MockObject\Matcher\StatelessInvocation;
2020
use PHPUnit\Framework\MockObject\MockObject;
21+
use PHPUnit\Framework\MockObject\Stub;
2122
use Prophecy\Prophecy\ProphecySubjectInterface;
2223
use ProxyManager\Proxy\ProxyInterface;
2324
use Symfony\Component\DependencyInjection\Argument\LazyClosure;
@@ -257,6 +258,7 @@ public static function checkClasses(): bool
257258

258259
for (; $i < \count($symbols); ++$i) {
259260
if (!is_subclass_of($symbols[$i], MockObject::class)
261+
&& !is_subclass_of($symbols[$i], Stub::class)
260262
&& !is_subclass_of($symbols[$i], ProphecySubjectInterface::class)
261263
&& !is_subclass_of($symbols[$i], Proxy::class)
262264
&& !is_subclass_of($symbols[$i], ProxyInterface::class)

src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -444,31 +444,31 @@
444444
</trans-unit>
445445
<trans-unit id="114">
446446
<source>This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words.</source>
447-
<target state="needs-review-translation">この値は短すぎます。少なくとも 1 つの単語を含める必要があります。|この値は短すぎます。少なくとも {{ min }} 個の単語を含める必要があります。</target>
447+
<target>この値は短すぎます。{{ min }}単語以上にする必要があります。</target>
448448
</trans-unit>
449449
<trans-unit id="115">
450450
<source>This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less.</source>
451-
<target state="needs-review-translation">この値は長すぎます。1 つの単語のみを含める必要があります。|この値は長すぎます。{{ max }} 個以下の単語を含める必要があります。</target>
451+
<target>この値は長すぎます。{{ max }}単語以下にする必要があります。</target>
452452
</trans-unit>
453453
<trans-unit id="116">
454454
<source>This value does not represent a valid week in the ISO 8601 format.</source>
455-
<target state="needs-review-translation">この値は ISO 8601 形式の有効な週を表していません。</target>
455+
<target>この値は ISO 8601 形式の有効な週を表していません。</target>
456456
</trans-unit>
457457
<trans-unit id="117">
458458
<source>This value is not a valid week.</source>
459-
<target state="needs-review-translation">この値は有効な週ではありません。</target>
459+
<target>この値は有効な週ではありません。</target>
460460
</trans-unit>
461461
<trans-unit id="118">
462462
<source>This value should not be before week "{{ min }}".</source>
463-
<target state="needs-review-translation">この値は週 "{{ min }}" より前であってはなりません。</target>
463+
<target>この値は週 "{{ min }}" より前であってはいけません。</target>
464464
</trans-unit>
465465
<trans-unit id="119">
466466
<source>This value should not be after week "{{ max }}".</source>
467-
<target state="needs-review-translation">この値は週 "{{ max }}" 以降であってはなりません。</target>
467+
<target>この値は週 "{{ max }}" 以降であってはいけません。</target>
468468
</trans-unit>
469469
<trans-unit id="120">
470470
<source>This value is not a valid slug.</source>
471-
<target state="needs-review-translation">この値は有効なスラグではありません。</target>
471+
<target>この値は有効なスラグではありません。</target>
472472
</trans-unit>
473473
</body>
474474
</file>

src/Symfony/Component/Yaml/Parser.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,18 @@ private function lexInlineQuotedString(int &$cursor = 0): string
11651165
private function lexUnquotedString(int &$cursor): string
11661166
{
11671167
$offset = $cursor;
1168-
$cursor += strcspn($this->currentLine, '[]{},:', $cursor);
1168+
1169+
while ($cursor < strlen($this->currentLine)) {
1170+
if (in_array($this->currentLine[$cursor], ['[', ']', '{', '}', ',', ':'], true)) {
1171+
break;
1172+
}
1173+
1174+
if (\in_array($this->currentLine[$cursor], [' ', "\t"], true) && '#' === ($this->currentLine[$cursor + 1] ?? '')) {
1175+
break;
1176+
}
1177+
1178+
++$cursor;
1179+
}
11691180

11701181
if ($cursor === $offset) {
11711182
throw new ParseException('Malformed unquoted YAML string.');
@@ -1242,7 +1253,7 @@ private function consumeWhitespaces(int &$cursor): bool
12421253
$whitespacesConsumed = 0;
12431254

12441255
do {
1245-
$whitespaceOnlyTokenLength = strspn($this->currentLine, ' ', $cursor);
1256+
$whitespaceOnlyTokenLength = strspn($this->currentLine, " \t", $cursor);
12461257
$whitespacesConsumed += $whitespaceOnlyTokenLength;
12471258
$cursor += $whitespaceOnlyTokenLength;
12481259

src/Symfony/Component/Yaml/Tests/ParserTest.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,6 +1769,69 @@ public function testParseMultiLineUnquotedString()
17691769
$this->assertSame(['foo' => 'bar baz foobar foo', 'bar' => 'baz'], $this->parser->parse($yaml));
17701770
}
17711771

1772+
/**
1773+
* @dataProvider unquotedStringWithTrailingComment
1774+
*/
1775+
public function testParseMultiLineUnquotedStringWithTrailingComment(string $yaml, array $expected)
1776+
{
1777+
$this->assertSame($expected, $this->parser->parse($yaml));
1778+
}
1779+
1780+
public function unquotedStringWithTrailingComment()
1781+
{
1782+
return [
1783+
'comment after comma' => [
1784+
<<<'YAML'
1785+
{
1786+
foo: 3, # comment
1787+
bar: 3
1788+
}
1789+
YAML,
1790+
['foo' => 3, 'bar' => 3],
1791+
],
1792+
'comment after space' => [
1793+
<<<'YAML'
1794+
{
1795+
foo: 3 # comment
1796+
}
1797+
YAML,
1798+
['foo' => 3],
1799+
],
1800+
'comment after space, but missing space after #' => [
1801+
<<<'YAML'
1802+
{
1803+
foo: 3 #comment
1804+
}
1805+
YAML,
1806+
['foo' => 3],
1807+
],
1808+
'comment after tab' => [
1809+
<<<YAML
1810+
{
1811+
foo: 3\t# comment
1812+
}
1813+
YAML,
1814+
['foo' => 3],
1815+
],
1816+
'comment after tab, but missing space after #' => [
1817+
<<<YAML
1818+
{
1819+
foo: 3\t#comment
1820+
}
1821+
YAML,
1822+
['foo' => 3],
1823+
],
1824+
'# in mapping value' => [
1825+
<<<'YAML'
1826+
{
1827+
foo: example.com/#about
1828+
}
1829+
YAML,
1830+
['foo' => 'example.com/#about'],
1831+
],
1832+
];
1833+
}
1834+
17721835
/**
17731836
* @dataProvider escapedQuotationCharactersInQuotedStrings
17741837
*/

0 commit comments

Comments
 (0)