in src/MarkdownExt/AutoLinkifyFilter.hack [109:155]
private static function getPath(
RenderContext $context,
string $search,
): ?string {
$search = Str\strip_prefix($search, '\\');
$ends = vec['<', '('];
foreach ($ends as $end) {
$idx = Str\search($search, $end);
if ($idx !== null) {
$search = Str\slice($search, 0, $idx);
}
}
$parts = Str\split($search, '::');
$class = $parts[0];
$method = $parts[1] ?? null;
if ($method !== null) {
return self::getPathForMethod($context, $class, $method);
}
$def = $context->getDocumentable()['definition'];
if ($def is ScannedClassish) {
$path = self::getPathForMethod($context, $def->getName(), $search);
if ($path !== null) {
return $path;
}
}
$parent = $context->getDocumentable()['parent']?->getName();
if ($parent !== null) {
$path = self::getPathForMethod($context, $parent, $search);
if ($path !== null) {
return $path;
}
}
$paths = $context->getPathProvider();
$prefixes = Vec\concat(vec[''], $context->getImplicitPrefixes());
return $prefixes
|> Vec\map(
$$,
$p ==> get_path_for_type($paths, $p.$search),
)
|> Vec\filter_nulls($$)
|> C\first($$);
}