binding value conflict handling

This commit is contained in:
Yuri Kuznetsov
2023-05-29 18:26:11 +03:00
parent 84062f331f
commit 646939bcf8
2 changed files with 4 additions and 9 deletions
@@ -121,11 +121,9 @@ class BindingContainer
$key &&
$this->data->hasContext($className, $key)
) {
// @todo For v7.6. Uncomment, then remove the return statement below.
/*$binding = $this->data->getContext($className, $key);
$binding = $this->data->getContext($className, $key);
$notMatching =
$type &&
$type instanceof ReflectionNamedType &&
!$type->isBuiltin() &&
$binding->getType() === Binding::VALUE &&
@@ -133,15 +131,12 @@ class BindingContainer
if (!$notMatching) {
return $binding;
}*/
return $this->data->getContext($className, $key);
}
}
$dependencyClassName = null;
if (
$type &&
$type instanceof ReflectionNamedType &&
!$type->isBuiltin()
) {
@@ -646,7 +646,7 @@ class BindingContainerTest extends \PHPUnit\Framework\TestCase
$this->assertTrue($container->hasByParam($class3, $param3));
}
/*public function testTypedParamWithScalarBound1(): void
public function testTypedParamWithScalarBound1(): void
{
$container = BindingContainerBuilder::create()
->inContext(Class0::class, function (ContextualBinder $binder): void {
@@ -681,5 +681,5 @@ class BindingContainerTest extends \PHPUnit\Framework\TestCase
$this->assertEquals(Binding::VALUE, $binding->getType());
$this->assertInstanceOf(Class1::class, $binding->getValue());
}*/
}
}