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

Breadcrumb

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

function Registry::forClassName

@psalm-param class-string $class

Throws

AnnotationsAreNotSupportedForInternalClassesException

ReflectionException

File

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

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 forClassName(string $class) : DocBlock {
    if (array_key_exists($class, $this->classDocBlocks)) {
        return $this->classDocBlocks[$class];
    }
    try {
        $reflection = new ReflectionClass($class);
        // @codeCoverageIgnoreStart
    } catch (\ReflectionException $e) {
        throw new ReflectionException($e->getMessage(), $e->getCode(), $e);
    }
    // @codeCoverageIgnoreEnd
    return $this->classDocBlocks[$class] = DocBlock::ofClass($reflection);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal