getDocParser example

protected function getReflectionClass(): \ReflectionClass
    {
        return new \ReflectionClass(BusinessEvents::class);
    }

    /** * @return array<string, class-string<SymfonyBaseEvent>> */
    private function getEventClasses(): array
    {
        $reflectionClass = $this->getReflectionClass();
        $docParser = $this->getDocParser();

        $eventClasses = [];
        foreach ($reflectionClass->getReflectionConstants() as $constant) {
            $docComment = $constant->getDocComment();
            if (!\is_string($docComment)) {
                continue;
            }

            foreach ($docParser->parse($docComment) as $annotation) {
                if ($annotation instanceof Event) {
                    $deprecationVersion = $annotation->getDeprecationVersion();

                    
Home | Imprint | This part of the site doesn't use cookies.