private function getAnnotationsFromReflection($reflection)
{
$fileLevel = ['package' => true, 'subpackage' => true, 'author' => true, 'license' => true, 'copyright' => true];
$annotations = [];
if ($reflection instanceof ReflectionClass || $reflection instanceof ReflectionFunction || $reflection instanceof ReflectionConstant && $reflection->getDeclaringClassName() === null) {
foreach ($reflection->getFileReflection()->getAnnotations() as $name => $value) {
if (isset($fileLevel[$name]) && empty($annotations[$name])) {
$annotations[$name] = $value;
}
}
}
return $annotations;
}