optimization code

This commit is contained in:
assert 2021-06-15 11:24:12 +08:00 committed by 李铭昕
parent 934058c479
commit f20bc175ec

View File

@ -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)