Skip to content

Show constant type alongside value in TOC and truncate long values#4108

Merged
jaapio merged 3 commits into
phpDocumentor:masterfrom
lacatoire:fix/toc-constant-show-type-and-truncated-value
Apr 17, 2026
Merged

Show constant type alongside value in TOC and truncate long values#4108
jaapio merged 3 commits into
phpDocumentor:masterfrom
lacatoire:fix/toc-constant-show-type-and-truncated-value

Conversation

@lacatoire

@lacatoire lacatoire commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #2443

@lacatoire lacatoire force-pushed the fix/toc-constant-show-type-and-truncated-value branch from 41887ea to 0652e36 Compare April 15, 2026 10:07

@jaapio jaapio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to move the truncation of this value into a filter in the twig extension. This allows other templates to reuse the same logic.

The current line is hard to interpret, a filter with the option to set the max length is easier to understand for users.

@jaapio

jaapio commented Apr 16, 2026

Copy link
Copy Markdown
Member

I didn't know this exists when I added my first comment. But we can use this twig filter: https://twig.symfony.com/doc/3.x/filters/u.html

Delegate constant value normalization and truncation in the TOC to the
twig/string-extra u filter backed by Symfony/String, removing the
custom truncate Twig filter.
@jaapio jaapio merged commit caa236d into phpDocumentor:master Apr 17, 2026
116 checks passed
@jaapio

jaapio commented Apr 17, 2026

Copy link
Copy Markdown
Member

Thanks for adjusting this.

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.

3.0.0: Suggestion: show constant type in TOC instead of value

2 participants