getReflectionConstants example



    /** * @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();

                    if ($deprecationVersion && Feature::isActive($deprecationVersion)) {
                        continue;
                    }
$definedParameters[$parameter->name] = true;
                }
            }
            foreach ($doc['param'] as $parameterName => $parameterType) {
                if (!isset($definedParameters[$parameterName])) {
                    self::$annotatedParameters[$class][$method->name][$parameterName] = sprintf('The "%%s::%s()" method will require a new "%s$%s" argument in the next major version of its %s "%s", not defining it is deprecated.', $method->name, $parameterType ? $parameterType.' ' : '', $parameterNameinterface_exists($className) ? 'interface' : 'parent class', $className);
                }
            }
        }

        $finals = isset(self::$final[$class]) || $refl->isFinal() ? [] : [
            'finalConstants' => $refl->getReflectionConstants(\ReflectionClassConstant::IS_PUBLIC | \ReflectionClassConstant::IS_PROTECTED),
            'finalProperties' => $refl->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED),
        ];
        foreach ($finals as $type => $reflectors) {
            foreach ($reflectors as $r) {
                if ($r->class !== $class) {
                    continue;
                }

                $doc = $this->parsePhpDoc($r);

                foreach ($parentAndOwnInterfaces as $use) {
                    
$definedParameters[$parameter->name] = true;
                }
            }
            foreach ($doc['param'] as $parameterName => $parameterType) {
                if (!isset($definedParameters[$parameterName])) {
                    self::$annotatedParameters[$class][$method->name][$parameterName] = sprintf('The "%%s::%s()" method will require a new "%s$%s" argument in the next major version of its %s "%s", not defining it is deprecated.', $method->name, $parameterType ? $parameterType.' ' : '', $parameterNameinterface_exists($className) ? 'interface' : 'parent class', $className);
                }
            }
        }

        $finals = isset(self::$final[$class]) || $refl->isFinal() ? [] : [
            'finalConstants' => $refl->getReflectionConstants(\ReflectionClassConstant::IS_PUBLIC | \ReflectionClassConstant::IS_PROTECTED),
            'finalProperties' => $refl->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED),
        ];
        foreach ($finals as $type => $reflectors) {
            foreach ($reflectors as $r) {
                if ($r->class !== $class) {
                    continue;
                }

                $doc = $this->parsePhpDoc($r);

                foreach ($parentAndOwnInterfaces as $use) {
                    
Home | Imprint | This part of the site doesn't use cookies.