diff --git a/Annotation/Annotation.php b/Annotation/Annotation.php index 3278b871..f83d1bdc 100644 --- a/Annotation/Annotation.php +++ b/Annotation/Annotation.php @@ -59,7 +59,7 @@ class Annotation extends Component * @param string $namespace * @param string $alias * @return $this - * @throws ReflectionException|NotFindPropertyException + * @throws ReflectionException|NotFindPropertyException|NotFindClassException */ public function readControllers(string $path, string $namespace, string $alias = 'root'): static { @@ -213,9 +213,6 @@ class Annotation extends Component } $name = get_class($object) . '_' . $method->getName(); - if (!isset($this->_annotations[$alias])) { - $this->_annotations[$alias] = []; - } if (!isset($this->_annotations[$alias][$name])) { $this->_annotations[$alias][$name] = []; } @@ -239,9 +236,9 @@ class Annotation extends Component * @param $class * @param $method * @param string $alias - * @return array|mixed + * @return mixed */ - public function getAnnotationByMethod($class, $method, $alias = '') + public function getAnnotationByMethod($class, $method, $alias = ''): mixed { if (!isset($this->_annotations[$alias])) { return []; diff --git a/HttpServer/Server.php b/HttpServer/Server.php index 3a753b52..4893cc5e 100644 --- a/HttpServer/Server.php +++ b/HttpServer/Server.php @@ -488,19 +488,6 @@ class Server extends HttpService $event->on(Event::SERVER_WORKER_START, function () { $attributes = Snowflake::app()->getAttributes(); $attributes->readControllers(SOCKET_PATH, 'App\Websocket', 'sockets'); - - $aliases = $attributes->getAlias('sockets'); - if (count($aliases) < 1) { - return; - } - foreach ($aliases as $alias) { - $handler = $alias['handler']; - foreach ($alias['attributes'] as $key => $attribute) { - if ($attribute instanceof IAnnotation) { - $attribute->execute($handler); - } - } - } }); }