Skip to content

Commit bc3bf13

Browse files
committed
fix: use invocable controllers with DI with bind by contracts
1 parent c8c9c94 commit bc3bf13

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Traits/GetDependenciesTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function resolveClassMethodDependencies(object $instance, string $method)
1818
}, (new ReflectionMethod($instance, $method))->getParameters());
1919
}
2020

21-
protected function transformDependency(ReflectionParameter $parameter)
21+
protected function transformDependency(ReflectionParameter $parameter): ?string
2222
{
2323
$type = $parameter->getType();
2424

@@ -29,7 +29,7 @@ protected function transformDependency(ReflectionParameter $parameter)
2929
return interface_exists($type->getName()) ? $this->getClassByInterface($type->getName()) : $type->getName();
3030
}
3131

32-
protected function getClassByInterface($interfaceName)
32+
protected function getClassByInterface($interfaceName): ?string
3333
{
3434
$bindings = Container::getInstance()->getBindings();
3535

@@ -39,6 +39,6 @@ protected function getClassByInterface($interfaceName)
3939
return null;
4040
}
4141

42-
return get_class($implementation(app()));
42+
return get_class(call_user_func($implementation, app()));
4343
}
4444
}

0 commit comments

Comments
 (0)