Контейнер: привязки, singleton и сборка аргументов
This commit is contained in:
1 parent
aaa08522e9
commit
9075c817dc
5 files changed
+484
-51
No files matched your search
@@ -357,6 +357,14 @@ final class Router
|
||||
continue;
|
||||
}
|
||||
|
||||
// Всё остальное с типом-классом собирает контейнер: так в действие
|
||||
// просят сервис, а не тащат его через конструктор контроллера
|
||||
if ($type instanceof ReflectionNamedType && !$type->isBuiltin() && Container::instance()->has($type->getName())) {
|
||||
$arguments[] = Container::instance()->make($type->getName());
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($parameter->isDefaultValueAvailable()) {
|
||||
$arguments[] = $parameter->getDefaultValue();
|
||||
|
||||
|
||||
Reference in new issue
Block a user