Skip to content

[YAML] Defining a reference on a merge key does not work. #23587

Closed
@magnusnordlander

Description

@magnusnordlander
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version all

In other YAML implementations, it is possible to define a reference on a merge key, e.g. as follows:

root:
    mergekeyrefdef:
        a: foo
        <<: &quux
            b: bar
            c: baz
    mergekeyderef:
        d: quux
        <<: *quux

This should be parsed as the following data structure:

    array(
        'mergekeyrefdef' => array('a' => 'foo', 'b' => 'bar', 'c' => 'baz'),
        'mergekeyderef' => array('d' => 'quux', 'b' => 'bar', 'c' => 'baz')
    )

However, in all Symfony versions, this emits the following error:

Symfony\Component\Yaml\Exception\ParseException: YAML merge keys used with a scalar value instead of an array at line 4 (near "<<: &quux").

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions