Skip to content

Commit 93f050c

Browse files
committed
Fixed empty doc for API references
1 parent 7324ccd commit 93f050c

File tree

4 files changed

+43
-23
lines changed

4 files changed

+43
-23
lines changed

util/docstheme/macros.twig

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,35 @@ class
136136
{% if member.static %} static{% endif %}
137137
{% endspaceless %}
138138
{%- endmacro -%}
139+
140+
{% macro method_parameters_signature(method) -%}
141+
{%- from "macros.twig" import hint_link -%}
142+
(
143+
{%- for parameter in method.parameters %}
144+
{%- if parameter.hashint %}{{ hint_link(parameter.hint) }} {% endif -%}
145+
{%- if parameter.variadic %}...{% endif %}${{ parameter.name|raw }}
146+
{%- if parameter.default is not null %} = {{ parameter.default }}{% endif %}
147+
{%- if not loop.last %}, {% endif %}
148+
{%- endfor -%}
149+
)
150+
{%- endmacro %}
151+
152+
{% macro hint_link(hints) -%}
153+
{%- from _self import class_link %}
154+
155+
{%- if hints %}
156+
{%- for hint in hints %}
157+
{%- if hint.class %}
158+
{{- class_link(hint.name) }}
159+
{%- elseif hint.name %}
160+
{{- abbr_class(hint.name) }}
161+
{%- endif %}
162+
{%- if hint.array %}[]{% endif %}
163+
{%- if not loop.last %}|{% endif %}
164+
{%- endfor %}
165+
{%- endif %}
166+
{%- endmacro %}
167+
168+
{% macro class_link(class, absolute) -%}
169+
{{- class }}
170+
{%- endmacro %}

util/docstheme/pages/class.twig

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,50 +36,33 @@ The {{ class_type(class) }} defines the following methods:
3636
{% if method.name != "__construct" %}
3737

3838

39-
{% if class.shortname != "ClientBuilder" %}
4039
[[{{ sanitize(replace_backslash(method)~"_"~method.name) }}]]
4140
.`{{ method.name }}()`
4241
{% if method.tags('note') %}
4342
{% for note in method.tags('note') %}
4443
*NOTE:* {{ note|join(' ') }}
4544
{% endfor %}
4645
{% endif %}
47-
****
48-
[source,php]
49-
----
50-
/*
51-
{% if method.shortdesc %}
52-
{{ method.shortdesc|raw }}
53-
{% endif %}
54-
*/
55-
56-
$params = [
57-
// ...
58-
];
59-
60-
$client = ClientBuilder::create()->build();
61-
$response = {{ get_namespace(class) }}->{{ method.name }}({{ param_list(method)|trim(',') }});
62-
----
63-
****
64-
{% else %}
6546
[[{{ sanitize(replace_backslash(method)~"_"~method.name) }}]]
66-
.`{{ method.name }}()`
47+
.`{{ method.name }}{{ block('method_parameters_signature') }}`
6748
****
6849
[source,php]
6950
----
7051
/*
7152
{% if method.shortdesc %}
72-
{{ method.shortdesc|raw }}
53+
{{ method.shortdesc|raw }}
7354
{% endif %}
7455
*/
75-
7656
----
7757
****
7858
{% endif %}
79-
{% endif %}
8059

8160
{% endfor %}
8261
{% endif %}
8362

8463
{% endblock %}
8564

65+
{% block method_parameters_signature -%}
66+
{%- from "macros.twig" import method_parameters_signature -%}
67+
{{ method_parameters_signature(method) }}
68+
{%- endblock %}

util/template/client-class

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ class Client
8989
}
9090

9191
/**
92+
* Extract an argument from the array of parameters
93+
*
9294
* @return null|mixed
9395
*/
9496
public function extractArgument(array &$params, string $arg)

util/template/client-namespace-function

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* Returns the :name namespace
3+
*/
14
public function :name(): :namespace
25
{
36
return $this->:name;

0 commit comments

Comments
 (0)