Skip to content

Commit bf07be4

Browse files
committed
[DependencyInjection][Xml] Fix the attribute 'tag' is not allowed in 'bind' tag
1 parent 4527e78 commit bf07be4

File tree

6 files changed

+8
-1
lines changed

6 files changed

+8
-1
lines changed

Loader/schema/dic/services/services-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@
222222
<xsd:attribute name="key" type="xsd:string" use="required" />
223223
<xsd:attribute name="on-invalid" type="invalid_sequence" />
224224
<xsd:attribute name="method" type="xsd:string" />
225+
<xsd:attribute name="tag" type="xsd:string" />
225226
</xsd:complexType>
226227

227228
<xsd:complexType name="argument" mixed="true">

Tests/Fixtures/Bar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Bar implements BarInterface
1515
{
1616
public $quz;
1717

18-
public function __construct($quz = null, \NonExistent $nonExistent = null, BarInterface $decorated = null, array $foo = [])
18+
public function __construct($quz = null, \NonExistent $nonExistent = null, BarInterface $decorated = null, array $foo = [], iterable $baz = [])
1919
{
2020
$this->quz = $quz;
2121
}

Tests/Fixtures/xml/services_bindings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<bind key="$foo" type="collection">
1313
<bind>null</bind>
1414
</bind>
15+
<bind key="iterable $baz" type="tagged_iterator" tag="bar"/>
1516
</service>
1617

1718
<service id="Symfony\Component\DependencyInjection\Tests\Fixtures\Bar">

Tests/Fixtures/yaml/services_bindings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ services:
1212
bind:
1313
Symfony\Component\DependencyInjection\Tests\Fixtures\BarInterface: '@Symfony\Component\DependencyInjection\Tests\Fixtures\Bar'
1414
$foo: [ ~ ]
15+
iterable $baz: !tagged_iterator bar
1516

1617
Symfony\Component\DependencyInjection\Tests\Fixtures\Bar:
1718
factory: [ ~, 'create' ]

Tests/Loader/XmlFileLoaderTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,12 +879,14 @@ public function testBindings()
879879
'$foo' => [null],
880880
'$quz' => 'quz',
881881
'$factory' => 'factory',
882+
'iterable $baz' => new TaggedIteratorArgument('bar'),
882883
], array_map(function (BoundArgument $v) { return $v->getValues()[0]; }, $definition->getBindings()));
883884
$this->assertEquals([
884885
'quz',
885886
null,
886887
new Reference(Bar::class),
887888
[null],
889+
new TaggedIteratorArgument('bar'),
888890
], $definition->getArguments());
889891

890892
$definition = $container->getDefinition(Bar::class);

Tests/Loader/YamlFileLoaderTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,12 +801,14 @@ public function testBindings()
801801
'$foo' => [null],
802802
'$quz' => 'quz',
803803
'$factory' => 'factory',
804+
'iterable $baz' => new TaggedIteratorArgument('bar'),
804805
], array_map(function (BoundArgument $v) { return $v->getValues()[0]; }, $definition->getBindings()));
805806
$this->assertEquals([
806807
'quz',
807808
null,
808809
new Reference(Bar::class),
809810
[null],
811+
new TaggedIteratorArgument('bar'),
810812
], $definition->getArguments());
811813

812814
$definition = $container->getDefinition(Bar::class);

0 commit comments

Comments
 (0)