- Some bugfixes linked to attributes
This commit is contained in:
parent
7c7d8c9d8d
commit
dd0f0271a6
|
@ -6,7 +6,7 @@
|
|||
"authors": [
|
||||
{
|
||||
"name": "Dave Mc Nicoll",
|
||||
"email": "mcndave@gmail.com"
|
||||
"email": "info@mcnd.ca"
|
||||
}
|
||||
],
|
||||
"require": {},
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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)");
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue