diff --git a/composer.json b/composer.json index 3fcbd8c..9fa3edb 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "authors": [ { "name": "Dave Mc Nicoll", - "email": "mcndave@gmail.com" + "email": "info@mcnd.ca" } ], "require": {}, diff --git a/src/ObjectReflection.php b/src/ObjectReflection.php index bba00cf..e6f8d08 100644 --- a/src/ObjectReflection.php +++ b/src/ObjectReflection.php @@ -136,7 +136,8 @@ class ObjectReflection { ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED | ReflectionMethod::IS_PRIVATE | - ReflectionMethod::IS_STATIC + ReflectionMethod::IS_STATIC | + ReflectionMethod::IS_FINAL ) : array { $list = []; @@ -168,6 +169,7 @@ class ObjectReflection { $current = [ 'name' => $method->getName(), + 'classname' => $method->class, 'type' => $method->hasReturnType() && $method->getReturnType() instanceof \ReflectionNamedType ? $method->getReturnType()->getName() : false, 'constructor' => $method->isConstructor(), 'destructor' => $method->isDestructor(), diff --git a/src/ObjectResolver.php b/src/ObjectResolver.php index 2900314..38beaf0 100644 --- a/src/ObjectResolver.php +++ b/src/ObjectResolver.php @@ -192,9 +192,9 @@ class ObjectResolver { return $list; } - public function instanciateAnnotationObject(array $tagDefinition) : Annotation + public function instanciateAnnotationObject(array $tagDefinition) : Annotation|\Notes\Attribute { - if (isset($tagDefinition['object']) && $tagDefinition['object'] instanceof \Attribute) { + if (isset($tagDefinition['object']) && $tagDefinition['object'] instanceof \Notes\Attribute) { return $tagDefinition['object']; } @@ -204,8 +204,13 @@ class ObjectResolver { return new class() implements Annotation {}; # throw new \InvalidArgumentException("Annotation class `{$tagDefinition['tag']}` was not found within {$this->objectClass} uses statement (or it's children / traits)"); } - - $obj = new $class(... $arguments['constructor']); + try { + $obj = new $class(... $arguments['constructor']); + } + catch (\Throwable $e) { + $err = $e::class; + throw new $err(sprintf("An error occured trying to instanciate class definition '%s' given argument '%s' : %s", var_export($tagDefinition, true), var_export($arguments['constructor'], true), $e->getMessage())); + } foreach($arguments['setter'] as $key => $value) { $obj->$key = $value;