return $loaded;
} /**
* @param \ReflectionClass|\ReflectionMethod|\ReflectionProperty $reflector
*/
public function loadAnnotations(object
$reflector): iterable
{ foreach ($reflector->
getAttributes() as $attribute) { if ($this->
isKnownAttribute($attribute->
getName())) { try { yield $attribute->
newInstance();
} catch (\Error
$e) { if (\Error::
class !== $e::
class) { throw $e;
} $on =
match (true
) { $reflector instanceof \ReflectionClass => ' on class '.
$reflector->name,
$reflector instanceof \ReflectionMethod =>
sprintf(' on "%s::%s()"',
$reflector->
getDeclaringClass()->name,
$reflector->name
),
$reflector instanceof \ReflectionProperty =>
sprintf(' on "%s::$%s"',
$reflector->
getDeclaringClass()->name,
$reflector->name
),
default => '',
};