[DI] Don't show internal service id on binding errors
This commit is contained in:
parent
771c22b7a5
commit
61f005af36
@ -117,9 +117,11 @@ class ResolveInstanceofConditionalsPass implements CompilerPassInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$definition->setBindings($bindings);
|
||||||
|
|
||||||
// reset fields with "merge" behavior
|
// reset fields with "merge" behavior
|
||||||
$abstract
|
$abstract
|
||||||
->setBindings($bindings)
|
->setBindings(array())
|
||||||
->setArguments(array())
|
->setArguments(array())
|
||||||
->setMethodCalls(array())
|
->setMethodCalls(array())
|
||||||
->setDecoratedService(null)
|
->setDecoratedService(null)
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
|
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
|
||||||
use Symfony\Component\DependencyInjection\ChildDefinition;
|
use Symfony\Component\DependencyInjection\ChildDefinition;
|
||||||
use Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass;
|
use Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass;
|
||||||
use Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass;
|
use Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass;
|
||||||
@ -250,4 +251,18 @@ class ResolveInstanceofConditionalsPassTest extends TestCase
|
|||||||
$this->assertEmpty($abstract->getTags());
|
$this->assertEmpty($abstract->getTags());
|
||||||
$this->assertTrue($abstract->isAbstract());
|
$this->assertTrue($abstract->isAbstract());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testBindings()
|
||||||
|
{
|
||||||
|
$container = new ContainerBuilder();
|
||||||
|
$def = $container->register('foo', self::class)->setBindings(array('$toto' => 123));
|
||||||
|
$def->setInstanceofConditionals(array(parent::class => new ChildDefinition('')));
|
||||||
|
|
||||||
|
(new ResolveInstanceofConditionalsPass())->process($container);
|
||||||
|
|
||||||
|
$bindings = $container->getDefinition('foo')->getBindings();
|
||||||
|
$this->assertSame(array('$toto'), array_keys($bindings));
|
||||||
|
$this->assertInstanceOf(BoundArgument::class, $bindings['$toto']);
|
||||||
|
$this->assertSame(123, $bindings['$toto']->getValues()[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user