Skip to content

Commit

Permalink
Only resolve instances, but do not force the type
Browse files Browse the repository at this point in the history
  • Loading branch information
bajb committed Dec 16, 2023
1 parent f55f52b commit 2b22963
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/DependencyInjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,13 @@ public function resolve(string $class, ...$parameters): mixed
return $this->resolveObject($class, ...$parameters);
}

public function resolved(Resolvable $instance)
public function resolved($instance)
{
$reflection = new \ReflectionMethod($instance, 'resolveWith');
$reflection->invokeArgs($instance, $this->_resolveParameters($reflection));
if($instance instanceof Resolvable)
{
$reflection = new \ReflectionMethod($instance, 'resolveWith');
$reflection->invokeArgs($instance, $this->_resolveParameters($reflection));
}
return $instance;
}

Expand Down

0 comments on commit 2b22963

Please sign in to comment.