Skip to content

Commit

Permalink
Fixed resolving declared class constructor instead of provided class …
Browse files Browse the repository at this point in the history
…one.
  • Loading branch information
Alexey Rehov committed Jun 27, 2017
1 parent 7338147 commit 514a785
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Container/src/AbstractContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,11 @@ private function createServiceFactoryFromClass(string $class): Closure
$constructor = $reflection->getConstructor();

if ($constructor && $constructor->getNumberOfParameters() > 0) {
$invokable = new Invokable($constructor);
if ($constructor->getDeclaringClass() !== $class) {
$invokable = new Invokable([$class, '__construct']);
} else {
$invokable = new Invokable($constructor);
}

return function (array $arguments = []) use ($invokable) {
return $this->invoker->invoke($invokable, $arguments);
Expand Down

0 comments on commit 514a785

Please sign in to comment.