Skip to content

TypeLinker

Renders a type as Markdown, linking the parts that have somewhere to point.

Only the class names inside a type are linked, never the whole thing, so list<Route>|null keeps list and null as plain text while Route reaches its page. A type used in a signature line is rendered plain instead: a link inside a code span does not render, so signatures stay code and the tables beside them carry the links.

final class TypeLinker

SourceEmitter/TypeLinker.php

public function __construct(ApiIndex $index, string $basePath = '/api'): mixed

ParameterTypeDescription
$indexApiIndex
$basePathstring

Returns mixed

MethodDescription
link(string $fqcn): ?stringThe link for one class, or null when it is not part of the reference.
plain(string $text): stringThe plain-text form of prose, for a frontmatter description where a link cannot go.
prose(string $text): stringTurns the markers the reference resolver left in prose into real links.
render(TypeRef $type): stringThe type as Markdown, with every documented class inside it linked.

public function link(string $fqcn): ?string

The link for one class, or null when it is not part of the reference.

ParameterTypeDescription
$fqcnstring

Returns ?``string

public function plain(string $text): string

The plain-text form of prose, for a frontmatter description where a link cannot go.

ParameterTypeDescription
$textstring

Returns string

public function prose(string $text): string

Turns the markers the reference resolver left in prose into real links.

A marker naming a member becomes a link to that member’s anchor on its class’s page. A marker naming something the reference does not document degrades to inline code, which still reads correctly.

ParameterTypeDescription
$textstring

Returns string

public function render(TypeRef $type): string

The type as Markdown, with every documented class inside it linked.

ParameterTypeDescription
$typeTypeRef

Returns string