Skip to content

Support a bookmark suffix on @see FQSEN references#454

Open
lacatoire wants to merge 1 commit intophpDocumentor:6.xfrom
lacatoire:feat/see-bookmark
Open

Support a bookmark suffix on @see FQSEN references#454
lacatoire wants to merge 1 commit intophpDocumentor:6.xfrom
lacatoire:feat/see-bookmark

Conversation

@lacatoire
Copy link
Copy Markdown

Parser side of phpDocumentor/phpDocumentor#3710. Accepts @see \\Foo::bar()#<bookmark> so a docblock can point at a specific anchor inside the target element; the #<bookmark> is extracted before FQSEN resolution and exposed via Reference\\Fqsen::getBookmark().

Reference\\Fqsen::__toString() intentionally keeps returning the bare FQSEN so existing consumers that feed it back into phpDocumentor\\Reflection\\Fqsen (which forbids #) keep working. See::__toString() re-attaches the bookmark so the full tag body still round-trips through parse + render. Url references are untouched.

Allow '@see \\Foo::bar()#<bookmark>' so a docblock can point at a
specific anchor inside the target element. The trailing '#<bookmark>'
is extracted from the reference token before FQSEN resolution and
stored on the Fqsen reference; an empty bookmark (trailing '#') is
normalised to null.

Fqsen::__toString() keeps returning the bare FQSEN so downstream
consumers that feed it back into phpDocumentor\\Reflection\\Fqsen
(which forbids '#') keep working. See::__toString() is aware of the
bookmark on Fqsen references and re-emits it, so the full tag body
round-trips through parse + render.

Url references are untouched — their native fragment has always been
preserved as-is.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant