Skip to content

Commit 89c0360

Browse files
bug symfony#61520 [Yaml] Fix scope resolution operator in flow mapping keys (MatTheCat)
This PR was merged into the 6.4 branch. Discussion ---------- [Yaml] Fix scope resolution operator in flow mapping keys | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix symfony#61082 | License | MIT Instead of splitting flow mapping keys by colon after `!php/const` or `!php/enum`, this PR splits by “lone” colon so that the `::` operator can be used. Commits ------- b09d67b [Yaml] Fix scope resolution operator in flow mapping keys
2 parents 1fc42d8 + b09d67b commit 89c0360

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Symfony/Component/Yaml/Inline.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ private static function parseMapping(string $mapping, int $flags, int &$i = 0, a
453453
}
454454

455455
if ('!php/const' === $key || '!php/enum' === $key) {
456-
$key .= ' '.self::parseScalar($mapping, $flags, [':'], $i, false);
456+
$key .= ' '.self::parseScalar($mapping, $flags, ['(?<!:):(?!:)'], $i, false);
457457
$key = self::evaluateScalar($key, $flags);
458458
}
459459

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public static function getTestsForParsePhpConstants()
6363
['{ foo: !php/const PHP_INT_MAX }', ['foo' => \PHP_INT_MAX]],
6464
['{ !php/const PHP_INT_MAX: foo }', [\PHP_INT_MAX => 'foo']],
6565
['!php/const NULL', null],
66+
['{ !php/const Symfony\Component\Yaml\Yaml::PARSE_CONSTANT: foo }', [Yaml::PARSE_CONSTANT => 'foo']],
6667
];
6768
}
6869

0 commit comments

Comments
 (0)