getParam('annotations'); assert($annotations instanceof AnnotationCollection); if (! $annotations->hasAnnotation(Name::class)) { return false; } foreach ($annotations as $annotation) { if (! $annotation instanceof Name) { continue; } return $annotation->getName(); } return false; } /** * Discover the fallback name via reflection */ public function discoverFallbackName(EventInterface $e): string { $reflection = $e->getParam('reflection'); if ($reflection instanceof ReflectionClass) { return $reflection->getShortName(); } return $reflection->getName(); } }