mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-04 04:37:46 +08:00
optimization code
This commit is contained in:
parent
934058c479
commit
f20bc175ec
@ -232,12 +232,13 @@ class AnnotationReader implements Reader
|
||||
|
||||
public function getAttributes(\Reflector $reflection): ?array
|
||||
{
|
||||
$result = null;
|
||||
if (method_exists($reflection, 'getAttributes') && $attributes = $reflection->getAttributes()) {
|
||||
return array_map(function (\ReflectionAttribute $attribute) {
|
||||
return $attribute->newInstance();
|
||||
}, $attributes);
|
||||
foreach ($attributes as $attribute) {
|
||||
$result[] = $attribute->newInstance();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getPropertyAnnotations(ReflectionProperty $property)
|
||||
|
Loading…
Reference in New Issue
Block a user