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