/** * Get the event subscriber. * * @return EventSubscriber Returns an instance of the EventSubscriber class. */ protected function getEventSubscriber() { // Check if the event subscriber has already been initialized if (!$this->eventSubscriber) { // Get the reflection class $reflectionClass = new \ReflectionClass($this->getEventSubscriberClass()); // Get the class instance $this->eventSubscriber = $reflectionClass->newInstance(); // Set the annotation reader $this->eventSubscriber->setAnnotationReader($this->getAnnotationReader()); } return $this->eventSubscriber; }