From ba8cd63b5c3fc3747df2b2a7b4457bb9599c9aaf Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Sat, 24 Apr 2021 16:25:41 +0800 Subject: [PATCH] modify --- Annotation/Loader.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Annotation/Loader.php b/Annotation/Loader.php index 17d459e8..22f5dac9 100644 --- a/Annotation/Loader.php +++ b/Annotation/Loader.php @@ -177,7 +177,7 @@ class Loader extends BaseObject } $this->appendFileToDirectory($path->getRealPath(), $replace->getName()); - $_array = ['handler' => $replace->newInstanceWithoutConstructor(), 'target' => [], 'methods' => [], 'property' => []]; + $_array = ['handler' => $replace, 'target' => [], 'methods' => [], 'property' => []]; foreach ($replace->getAttributes() as $attribute) { if ($attribute->getName() == Attribute::class) { continue; @@ -398,12 +398,13 @@ class Loader extends BaseObject if ($annotations === null) { continue; } + $handler = $annotations['handler']->newInstance(); foreach ($annotations['target'] ?? [] as $value) { - $value->execute([$annotations['handler']]); + $value->execute([$handler]); } foreach ($annotations['methods'] as $name => $attribute) { foreach ($attribute as $value) { - $value->execute([$annotations['handler'], $name]); + $value->execute([$handler, $name]); } } }