Skip to content

Commit bb2edcf

Browse files
committed
Show templates info for methods
Refs #333
1 parent 3f4d98a commit bb2edcf

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/Reflection/DocBlock.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ public function __construct(?string $block)
5252
}
5353
}
5454

55+
$tags = $node->getTagsByName('@template');
56+
array_walk($tags, fn($tag) => $this->tags['template'][] = $tag->value);
57+
5558
$tags = $node->getTagsByName('@var');
5659
if ($tags) {
5760
$this->tags['var'] = current($tags)->value;

templates/pages/parts/function-detail.twig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@
4040
{{ function.doc.summary|markdown_to_html }}
4141
{{ function.doc.description|markdown_to_html }}
4242

43+
{% if function.doc.tags.template is defined %}
44+
<h6>Templates</h6>
45+
<div class="list">
46+
{% for tag in function.doc.tags.template %}
47+
<code>
48+
{{ tag.name }}
49+
{% if tag.bound is not null %} of {tag.bound}{% endif %}
50+
{% if tag.default is not null %} = {tag.default}{% endif %}
51+
</code><br>
52+
{{ tag.description }}{{ loop.last ? '' : '<br>' }}
53+
{% endfor %}
54+
</div>
55+
{% endif %}
56+
4357
{% if function.params %}
4458
<h6>Parameters</h6>
4559
<div class="parameter-list list">

0 commit comments

Comments
 (0)