ResolveBindingsPass remove loading of class iterable
This commit is contained in:
parent
c7a5902a20
commit
f9f78c7c2a
|
@ -125,7 +125,7 @@ class ResolveBindingsPass extends AbstractRecursivePass
|
|||
$this->unusedBindings[$bindingId] = [$key, $this->currentId, $bindingType, $file];
|
||||
}
|
||||
|
||||
if (preg_match('/^(?:(?:array|bool|float|int|string|([^ $]++)) )\$/', $key, $m)) {
|
||||
if (preg_match('/^(?:(?:array|bool|float|int|string|iterable|([^ $]++)) )\$/', $key, $m)) {
|
||||
$bindingNames[substr($key, \strlen($m[0]))] = $binding;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
|
|||
use Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum;
|
||||
use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy;
|
||||
use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedEnumArgumentDummy;
|
||||
use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedIterableArgumentDummy;
|
||||
use Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists;
|
||||
use Symfony\Component\DependencyInjection\TypedReference;
|
||||
|
||||
|
@ -209,4 +210,17 @@ class ResolveBindingsPassTest extends TestCase
|
|||
$pass = new ResolveBindingsPass();
|
||||
$pass->process($container);
|
||||
}
|
||||
|
||||
public function testIterableBindingTypehint()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$definition = $container->register('bar', NamedIterableArgumentDummy::class);
|
||||
$definition->setBindings([
|
||||
'iterable $items' => new TaggedIteratorArgument('foo'),
|
||||
]);
|
||||
$pass = new ResolveBindingsPass();
|
||||
$pass->process($container);
|
||||
|
||||
$this->assertInstanceOf(TaggedIteratorArgument::class, $container->getDefinition('bar')->getArgument(0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
|
||||
|
||||
class NamedIterableArgumentDummy
|
||||
{
|
||||
public function __construct(iterable $items)
|
||||
{
|
||||
}
|
||||
}
|
Reference in New Issue