diff --git a/Server/ServerManager.php b/Server/ServerManager.php index 33c060b3..cd943d53 100644 --- a/Server/ServerManager.php +++ b/Server/ServerManager.php @@ -229,7 +229,6 @@ class ServerManager extends Abstracts\Server */ private function addNewListener(string $type, string $host, int $port, int $mode, array $settings = []) { - var_dump(func_get_args()); echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m $type service %s::%d start.", $host, $port) . PHP_EOL; /** @var Server\Port $service */ $this->ports[$port] = $this->server->addlistener($host, $port, $mode); diff --git a/System/Di/Container.php b/System/Di/Container.php index d05fdbf0..d54680a3 100644 --- a/System/Di/Container.php +++ b/System/Di/Container.php @@ -107,9 +107,7 @@ class Container extends BaseObject private function resolve($class, $constrict, $config): object { $reflect = $this->resolveDependencies($class); - if ($reflect->isAbstract() || !$reflect->isInstantiable()) { - throw new ReflectionException('Class ' . $class . ' cannot be instantiated'); - } + $object = $this->newInstance($reflect, $constrict); $this->propertyInject($reflect, $object); @@ -163,6 +161,7 @@ class Container extends BaseObject * @param $className * @param $method * @return array + * @throws ReflectionException */ public function getMethodAttribute($className, $method = null): array { @@ -178,6 +177,7 @@ class Container extends BaseObject * @param string $class * @param string|null $property * @return ReflectionProperty|ReflectionProperty[]|null + * @throws ReflectionException */ public function getClassReflectionProperty(string $class, string $property = null): ReflectionProperty|null|array { @@ -210,11 +210,14 @@ class Container extends BaseObject /** * @param $class * @return ReflectionClass + * @throws ReflectionException */ private function resolveDependencies($class): ReflectionClass { $reflect = new ReflectionClass($class); - + if ($reflect->isAbstract() || !$reflect->isInstantiable()) { + throw new ReflectionException('Class ' . $class . ' cannot be instantiated'); + } $this->setPropertyNote($reflect); $this->setTargetNote($reflect); $this->setMethodNote($reflect); @@ -229,6 +232,7 @@ class Container extends BaseObject /** * @param ReflectionClass|string $class * @return ReflectionMethod[] + * @throws ReflectionException */ public function getReflectMethods(ReflectionClass|string $class): array { @@ -243,6 +247,7 @@ class Container extends BaseObject * @param ReflectionClass|string $class * @param string $method * @return ReflectionMethod|null + * @throws ReflectionException */ public function getReflectMethod(ReflectionClass|string $class, string $method): ?ReflectionMethod { @@ -341,6 +346,7 @@ class Container extends BaseObject /** * @param $class * @return ReflectionClass|null + * @throws ReflectionException */ public function getReflect($class): ?ReflectionClass {