From 0e7b59eb9c3a0983aeee42408f761c5f0c5344b1 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Sun, 29 Aug 2021 04:06:48 +0800 Subject: [PATCH] 111 --- src/Annotation/Get.php | 18 ++++++++++-------- src/Annotation/Relation.php | 35 ++++++++++++++++++----------------- src/Annotation/Set.php | 10 ++++++---- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/Annotation/Get.php b/src/Annotation/Get.php index c670948..1dcb14c 100644 --- a/src/Annotation/Get.php +++ b/src/Annotation/Get.php @@ -26,15 +26,17 @@ use Exception; } - /** - * @param mixed $class - * @param mixed|null $method - * @return bool - * @throws Exception - */ - public function execute(mixed $class, mixed $method = null): bool + /** + * @param static $params + * @param mixed $class + * @param mixed|null $method + * @return bool + * @throws \Kiri\Exception\NotFindClassException + * @throws \ReflectionException + */ + public static function execute(mixed $params, mixed $class, mixed $method = null): bool { - di(Getter::class)->addGetter($this->name, $class, $method); + di(Getter::class)->addGetter($params->name, $class, $method); return true; } diff --git a/src/Annotation/Relation.php b/src/Annotation/Relation.php index 1b7e9c1..1226d43 100644 --- a/src/Annotation/Relation.php +++ b/src/Annotation/Relation.php @@ -20,25 +20,26 @@ use Kiri\Kiri; { - /** - * Relation constructor. - * @param string $name - */ - public function __construct(public string $name) - { - } + /** + * Relation constructor. + * @param string $name + */ + public function __construct(string $name) + { + } - /** - * @param mixed $class - * @param mixed|null $method - * @return bool - * @throws Exception - */ - public function execute(mixed $class, mixed $method = null): bool - { - di(Relate::class)->addRelate($class, $this->name, $method); + /** + * @param static $params + * @param mixed $class + * @param mixed|null $method + * @return bool + * @throws Exception + */ + public static function execute(mixed $params, mixed $class, mixed $method = null): bool + { + di(Relate::class)->addRelate($class, $params->name, $method); return true; - } + } } diff --git a/src/Annotation/Set.php b/src/Annotation/Set.php index 7c7a2ce..ef5e759 100644 --- a/src/Annotation/Set.php +++ b/src/Annotation/Set.php @@ -16,20 +16,22 @@ use Exception; * Set constructor. * @param string $name */ - public function __construct(public string $name) + public function __construct(string $name) { } /** + * @param static $params * @param mixed $class * @param mixed|null $method * @return bool - * @throws Exception + * @throws \Kiri\Exception\NotFindClassException + * @throws \ReflectionException */ - public function execute(mixed $class, mixed $method = null): bool + public static function execute(mixed $params, mixed $class, mixed $method = null): bool { - di(Setter::class)->addSetter($this->name, $class, $method); + di(Setter::class)->addSetter($params->name, $class, $method); return true; }