diff --git a/Annotation/Event.php b/Annotation/Event.php index 9a146c66..36a8b983 100644 --- a/Annotation/Event.php +++ b/Annotation/Event.php @@ -35,7 +35,7 @@ use Kiri\Events\EventProvider; public function execute(mixed $class, mixed $method = null): bool { $pro = di(EventProvider::class); - $pro->on($this->name, [$class, $method]); + $pro->on($this->name, [di($class), $method]); return true; } diff --git a/Annotation/Inject.php b/Annotation/Inject.php index 9ff067d2..03895889 100644 --- a/Annotation/Inject.php +++ b/Annotation/Inject.php @@ -74,6 +74,7 @@ use Kiri\Kiri; * @param $class * @param $method * @return ReflectionProperty|bool + * @throws ReflectionException */ private function getProperty($class, $method): ReflectionProperty|bool { diff --git a/Annotation/LocalService.php b/Annotation/LocalService.php index b65d5c4e..396337d2 100644 --- a/Annotation/LocalService.php +++ b/Annotation/LocalService.php @@ -45,11 +45,10 @@ use Server\Events\OnWorkerExit; */ public function execute(mixed $class, mixed $method = null): bool { - $class = ['class' => $class::class]; + $class = ['class' => $class]; if (!empty($this->args)) { $class = array_merge($class, $this->args); } - Kiri::set($this->service, $class); return true; // TODO: Change the autogenerated stub } diff --git a/Annotation/Model/Get.php b/Annotation/Model/Get.php index a77b7bd7..3b101512 100644 --- a/Annotation/Model/Get.php +++ b/Annotation/Model/Get.php @@ -35,7 +35,7 @@ use Kiri\Kiri; public function execute(mixed $class, mixed $method = null): bool { $annotation = Kiri::getAnnotation(); - $annotation->addGets($class::class, $this->name, $method); + $annotation->addGets($class, $this->name, $method); return true; } diff --git a/Annotation/Model/Relation.php b/Annotation/Model/Relation.php index b6174596..46c48316 100644 --- a/Annotation/Model/Relation.php +++ b/Annotation/Model/Relation.php @@ -37,7 +37,7 @@ use Kiri\Kiri; public function execute(mixed $class, mixed $method = null): bool { $annotation = Kiri::getAnnotation(); - $annotation->addRelate($class::class, $this->name, $method); + $annotation->addRelate($class, $this->name, $method); return true; } diff --git a/Annotation/Model/Set.php b/Annotation/Model/Set.php index 60044e61..8e977fc6 100644 --- a/Annotation/Model/Set.php +++ b/Annotation/Model/Set.php @@ -31,7 +31,7 @@ use Kiri\Kiri; public function execute(mixed $class, mixed $method = null): bool { $annotation = Kiri::getAnnotation(); - $annotation->addSets($class::class, $this->name, $method); + $annotation->addSets($class, $this->name, $method); return true; } diff --git a/Annotation/Route/Route.php b/Annotation/Route/Route.php index 73594ef0..f4c6ef24 100644 --- a/Annotation/Route/Route.php +++ b/Annotation/Route/Route.php @@ -37,7 +37,7 @@ use Kiri\Kiri; { // TODO: Implement setHandler() method. $router = Kiri::app()->getRouter(); - $router->addRoute($this->uri, [$class, $method], $this->method); + $router->addRoute($this->uri, [di($class::class), $method], $this->method); return $router; } diff --git a/Annotation/Route/Socket.php b/Annotation/Route/Socket.php index 6d34a7e8..58871e8d 100644 --- a/Annotation/Route/Socket.php +++ b/Annotation/Route/Socket.php @@ -44,7 +44,7 @@ use Kiri\Kiri; $path = $this->event . '::' . (is_null($this->uri) ? 'event' : $this->uri); - $router->addRoute($path, [$class, $method], 'sw::socket'); + $router->addRoute($path, [di($class), $method], 'sw::socket'); return $router; } diff --git a/Kafka/KafkaProvider.php b/Kafka/KafkaProvider.php index f5f85507..ba75f0d3 100644 --- a/Kafka/KafkaProvider.php +++ b/Kafka/KafkaProvider.php @@ -27,7 +27,7 @@ class KafkaProvider extends BaseObject if (isset($this->_topics[$topic])) { return; } - $this->_topics[$topic] = $handler::class; + $this->_topics[$topic] = $handler; } diff --git a/Server/Worker/OnServerWorker.php b/Server/Worker/OnServerWorker.php index 7f067e10..803f285f 100644 --- a/Server/Worker/OnServerWorker.php +++ b/Server/Worker/OnServerWorker.php @@ -71,9 +71,8 @@ class OnServerWorker extends \Server\Abstracts\Server $fileLists = $annotation->runtime(APP_PATH . 'app'); $di = Kiri::getDi(); foreach ($fileLists as $class) { - $instance = $di->get($class); foreach ($di->getTargetNote($class) as $value) { - $value->execute($instance); + $value->execute($class); } $methods = $di->getMethodAttribute($class); foreach ($methods as $method => $attribute) { @@ -81,7 +80,7 @@ class OnServerWorker extends \Server\Abstracts\Server continue; } foreach ($attribute as $item) { - $item->execute($instance, $method); + $item->execute($class, $method); } } } diff --git a/System/Async.php b/System/Async.php index d0013ff0..fe8a779c 100644 --- a/System/Async.php +++ b/System/Async.php @@ -24,9 +24,9 @@ class Async extends Component /** * @param string $name - * @param TaskExecute $handler + * @param TaskExecute|string $handler */ - public function addAsync(string $name, TaskExecute $handler) + public function addAsync(string $name, TaskExecute|string $handler) { static::$_absences[$name] = $handler::class; }