Skip to content

Commit

Permalink
Merge pull request #3 from ray-di/hotfix
Browse files Browse the repository at this point in the history
Hotfix: bind also name on the fly
  • Loading branch information
koriym authored Jun 19, 2020
2 parents 8537664 + 8f7ed3b commit f512aef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ObjectGrapher.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private function addClassNode(string $dependencyIndex) : void
}
$container = $this->container->getContainer();
if (! isset($container[$dependencyIndex])) {
$this->bindOnTheFly($dependencyIndex, $type);
$this->bindOnTheFly($dependencyIndex, $type, $name);
}
}

Expand All @@ -182,9 +182,9 @@ private function drawInjectionGraph(array $arguments, string $classId, string $p
/**
* @throws \ReflectionException
*/
private function bindOnTheFly(string $dependencyIndex, string $type) : void
private function bindOnTheFly(string $dependencyIndex, string $type, string $name) : void
{
$this->container->add((new Bind($this->container, $type))->to($type));
$this->container->add((new Bind($this->container, $type))->annotatedWith($name)->to($type));
$dependency = $this->container->getContainer()[$dependencyIndex];
assert($dependency instanceof Dependency);
$setters = $this->lineDependency(new MyDependency($dependency));
Expand Down

0 comments on commit f512aef

Please sign in to comment.