Closed
Description
Symfony version(s) affected
6.1.0
Description
Starting with [new TaggedValue('a', 5)]
, after a round trip through yaml, the number 5
becomes a string '5'
.
The problem is clearly with the parser, because the dumped yml code seems correct.
How to reproduce
$data = [5, new TaggedValue('a', 5)];
$yaml = $this->dumper->dump($data, 2);
$expected = <<<YAML
- 5
- !a 5
YAML;
$this->assertSame($expected, $yaml); // Pass.
$this->assertSame($data, $this->parser->parse($yaml, Yaml::PARSE_CUSTOM_TAGS)); // Fail.
The standalone 5 survives the round-trip.
The tagged 5 becomes a string.
Possible Solution
Fix the parser. Not sure where exactly.
Additional Context
No response