Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Registry.php

function Registry::forMethod

@psalm-param class-string $classInHierarchy

Throws

AnnotationsAreNotSupportedForInternalClassesException

ReflectionException

File

vendor/phpunit/phpunit/src/Metadata/Parser/Annotation/Registry.php, line 78

Class

Registry
Reflection information, and therefore DocBlock information, is static within a single PHP process. It is therefore okay to use a Singleton registry here.

Namespace

PHPUnit\Metadata\Annotation\Parser

Code

public function forMethod(string $classInHierarchy, string $method) : DocBlock {
    if (isset($this->methodDocBlocks[$classInHierarchy][$method])) {
        return $this->methodDocBlocks[$classInHierarchy][$method];
    }
    try {
        $reflection = new ReflectionMethod($classInHierarchy, $method);
        // @codeCoverageIgnoreStart
    } catch (\ReflectionException $e) {
        throw new ReflectionException($e->getMessage(), $e->getCode(), $e);
    }
    // @codeCoverageIgnoreEnd
    return $this->methodDocBlocks[$classInHierarchy][$method] = DocBlock::ofMethod($reflection);
}
RSS feed
Powered by Drupal