Skip to content

Commit 8932c04

Browse files
committed
Add inheritance template
1 parent 272157b commit 8932c04

File tree

7 files changed

+24
-11
lines changed

7 files changed

+24
-11
lines changed

tests/Functional/PhpdocOutputTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ public static function dataProviderTestFiles(): iterable
2525
array(
2626
'path' => 'classes/PhpDocumentorMarkdown/Example/ReviewableTrait.md',
2727
),
28+
array(
29+
'path' => 'classes/PhpDocumentorMarkdown/Example/ManyInterfaces.md',
30+
),
2831
array(
2932
'path' => 'classes/PhpDocumentorMarkdown/Example/Pizza/Base.md',
3033
),

tests/Functional/expected/classes/PhpDocumentorMarkdown/Example/ManyInterfaces.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# ManyInterfaces
22

3-
ManyInterfaces description
3+
A ManyInterfaces
4+
5+
ManyInterfaces description
46

57
- **See:** \PhpDocumentorMarkdown\Example\AbstractProduct
68

79
***
810

911
* Full name: `\PhpDocumentorMarkdown\Example\ManyInterfaces`
1012
* Parent interfaces:
11-
[`\PhpDocumentorMarkdown\Example\ProductInterface`](./ProductInterface.md)[`JsonSerializable`](../../JsonSerializable.md),
13+
[`\PhpDocumentorMarkdown\Example\ProductInterface`](./ProductInterface.md),
14+
`JsonSerializable`
1215

1316
## Inherited methods
1417

tests/Functional/expected/classes/PhpDocumentorMarkdown/Example/Pizza.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A pizza \| pie.
88
* Parent class: [`\PhpDocumentorMarkdown\Example\AbstractProduct`](./AbstractProduct.md)
99
* This class implements:
1010
[`\PhpDocumentorMarkdown\Example\ProductInterface`](./ProductInterface.md),
11-
[`\JsonSerializable`](../../JsonSerializable.md)
11+
`\JsonSerializable`
1212

1313
## Properties
1414

themes/markdown/class.md.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{% if node.deprecated %}* **Warning:** this class is **deprecated**. This means that this class will likely be removed in a future version.
1313
{% endif %}
1414
{% if node.interfaces is not empty %}* This class implements:
15-
{% for interface in node.interfaces %}{% if loop.index0 > 0 %}{{ ',\n ' }}{% else %}{{ ' ' }}{% endif %}{{ macros.mdLink(interface, macros.mdClassPath(node), interface, 'class') }}{% endfor %}
15+
{% include 'partials/inheritance.md.twig' with { node: node, others: node.interfaces } only %}
1616

1717
{% endif %}
1818
{% if node.abstract %}* This class is an **Abstract class**

themes/markdown/interface.md.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
* Full name: `{{ node.FullyQualifiedStructuralElementName }}`
88
{% if node.parent and node.parent is not empty %}* Parent interfaces:
9-
{% for parent in node.parent %}{% if loop.index0 == 0 %}{{ ' ' }}{% endif %}{{ macros.mdLink(parent, macros.mdClassPath(node), parent.FullyQualifiedStructuralElementName, 'class') }}{% if loop.index0 > 0 %}{{ ', ' }}{% endif %}{% endfor %}
9+
{% include 'partials/inheritance.md.twig' with { node: node, others: node.parent } only %}
1010

1111
{% endif %}
1212
{% if node.final %}* This interface is marked as **final** and can't be subclassed
1313
{% endif %}
1414
{% if node.deprecated %}* **Warning:** this interface is **deprecated**. This means that this interface will likely be removed in a future version.
1515
{% endif %}
1616
{% if node.interfaces is not empty %}* This interface implements:
17-
{% for interface in node.interfaces %}{% if loop.index0 == 0 %}{{ ' ' }}{% endif %}{{ macros.mdLink(interface, macros.mdClassPath(node), interface, 'class') }}{% if loop.index0 > 0 %}{{ ', ' }}{% endif %}{% endfor %}
17+
{% include 'partials/inheritance.md.twig' with { node: node, others: node.interfaces } only %}
1818

1919
{% endif %}
2020
{% include 'partials/tags.md.twig' with { tags: node.tags } only %}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% import 'include/macros.twig' as macros %}
2+
{%- for otherNode in others -%}
3+
{%- if loop.index0 > 0 -%}
4+
{{- ',\n ' -}}
5+
{%- else -%}
6+
{{- ' ' -}}
7+
{%- endif -%}
8+
{{- macros.mdLink(otherNode, macros.mdClassPath(node), otherNode.FullyQualifiedStructuralElementName, 'class') -}}
9+
{%- endfor -%}

themes/markdown/trait.md.twig

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
{% endif %}
1212
{% if node.deprecated %}* **Warning:** this trait is **deprecated**. This means that this class will likely be removed in a future version.
1313
{% endif %}
14-
{% if node.interfaces is not empty %}
15-
* This trait implements:
16-
{% for interface in node.interfaces %}
17-
{% if loop.index0 > 0 %}{{ ', ' }}{% endif %}{{ macros.mdLink(interface, macros.mdClassPath(node), interface, 'class') }}
18-
{% endfor %}
14+
{% if node.interfaces is not empty %}* This trait implements:
15+
{% include 'partials/inheritance.md.twig' with { node: node, others: node.interfaces } only %}
16+
1917
{% endif %}
2018
{% include 'partials/tags.md.twig' with { tags: node.tags } only %}
2119
{% if node.properties | length > 0 %}

0 commit comments

Comments
 (0)