function Registry::forClassName
@psalm-param class-string $class
Throws
AnnotationsAreNotSupportedForInternalClassesException
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\ParserCode
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);
}