Skip to content

Commit

Permalink
[TASK] Use partial includes for method names and FQNs
Browse files Browse the repository at this point in the history
  • Loading branch information
linawolf committed May 15, 2024
1 parent 7097a01 commit 4740944
Show file tree
Hide file tree
Showing 54 changed files with 140 additions and 246 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{%- if node.name.namespaceNode %}{%- set fqn = '\\' ~ node.name.namespaceNode.name ~ '\\' ~ node.name.namespaceNode.name -%}{% endif -%}
<dl class="php {{ node.type }}">
<dt class="sig sig-object php"
{%- if not node.noindex %} id="{{ node.id }}"{% endif -%}>
{% for modifier in node.modifiers -%}
{{- renderNode(modifier) }}{{ ' ' -}}
{%- endfor -%}
<em class="property"><span class="pre">{{ node.type }}</span> </em>
{{ renderNode(node.name) }} {%- if node.type == 'enum' and node.phpType -%}<span class="pre"> : {{ node.phpType }}</span> {% endif -%}
{% include "body/directive/php/partials/fullyQualifiedName.html.twig" with {'className': node.name, 'fqn': fqn} %}
{%- if node.type == 'enum' and node.phpType -%}<span class="pre"> : {{ node.phpType }}</span> {% endif -%}
{% include "body/directive/php/partials/linkToSnippet.html.twig" %}
</dt>
<dd>
Expand All @@ -14,7 +16,6 @@
{% if node.name.namespaceNode %}
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
{% set fqn = '\\' ~ node.name.namespaceNode.name ~ '\\' ~ node.name.namespaceNode.name %}
{% include "body/directive/php/partials/codeStyle.html.twig" with {'code': fqn} %}
</dd>
{% endif -%}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{%- for modifier in node.modifiers -%}
{{- renderNode(modifier) }}{{ ' ' -}}
{%- endfor -%}
{{- renderNode(node.methodName) -}}
{% include "body/directive/php/partials/method/methodName.html.twig" with {'methodName': node.methodName} %}
{% include "body/directive/php/partials/linkToSnippet.html.twig" %}
</dt>
<dd>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<span class="sig-name descname">
<span class="pre fqn"
{%- if fqn %} data-fqn="{{ fqn }}" title="{{ fqn }}"{% endif %}>
{{- className.name -}}
</span>
</span>
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

<span class="sig-name descname">
{%- for modifier in node.modifiers -%}
{%- for modifier in methodName.modifiers -%}
<span class="pre php-modifier">{{- renderNode(modifier) }}{{ ' ' -}}</span>
{%- endfor -%}
<span class="pre">{{ node.name }}</span></span>
<span class="pre">{{ methodName.name }}</span></span>
<span class="sig-paren">(</span>
{% for param in node.params -%}
{% for param in methodName.params -%}
<em class="sig-param"><span class="pre">{{ param }}</span></em>
{%- if not loop.last %}, {% endif -%}
{%- endfor %}
<span class="sig-paren">)</span>
{% if node.return %}
<em class="sig-returns"><span class="pre">: {{ node.return }}</span></em>
{% if methodName.return %}
<em class="sig-returns"><span class="pre">: {{ methodName.return }}</span></em>
{% endif %}
2 changes: 0 additions & 2 deletions src/DependencyInjection/GuidesPhpDomainExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public function prepend(ContainerBuilder $container): void
[
'base_template_paths' => [dirname(__DIR__, 2) . '/resources/template/html'],
'templates' => [
template(FullyQualifiedNameNode::class, 'body/directive/php/fullyQualifiedName.html.twig'),
template(PhpCaseNode::class, 'body/directive/php/case.html.twig'),
template(PhpComponentNode::class, 'body/directive/php/component.html.twig'),
template(PhpConstNode::class, 'body/directive/php/const.html.twig'),
Expand All @@ -54,7 +53,6 @@ public function prepend(ContainerBuilder $container): void
template(PhpPropertyNode::class, 'body/directive/php/property.html.twig'),
template(PhpModifierNode::class, 'body/directive/php/modifier.html.twig'),
template(MemberNameNode::class, 'body/directive/php/memberName.html.twig'),
template(MethodNameNode::class, 'body/directive/php/methodName.html.twig'),
],
],
);
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/class-abstract/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ <h1>abstract class</h1>
<dt class="sig sig-object php" id="typo3-cms-core-abstracttest">
<span class="sig-name modifier"><span class="pre">abstract</span></span> <em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\AbstractTest">
AbstractTest
</span>
<span class="pre fqn" data-fqn="\TYPO3\CMS\Core\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\TYPO3\CMS\Core">AbstractTest</span>
</span> <a class="headerlink" href="#typo3-cms-core-abstracttest" title="Permalink to this definition"></a>
</dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
</dl>

<p>Lorem Ipsum Dolor!</p>
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/class-duplicate/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ <h1>final class</h1>
<dt class="sig sig-object php" id="typo3-cms-core-test">
<span class="sig-name modifier"><span class="pre">final</span></span> <em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\Test">
Test
</span>
<span class="pre fqn" data-fqn="\TYPO3\CMS\Core\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\TYPO3\CMS\Core">Test</span>
</span> <a class="headerlink" href="#typo3-cms-core-test" title="Permalink to this definition"></a>
</dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
</dl>

<p>Lorem Ipsum Dolor!</p>
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/class-final-abstract/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ <h1>abstract final class causes warning</h1>
<dt class="sig sig-object php" id="typo3-cms-core-test">
<span class="sig-name modifier"><span class="pre">abstract</span></span> <span class="sig-name modifier"><span class="pre">final</span></span> <em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\Test">
Test
</span>
<span class="pre fqn" data-fqn="\TYPO3\CMS\Core\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\TYPO3\CMS\Core">Test</span>
</span> <a class="headerlink" href="#typo3-cms-core-test" title="Permalink to this definition"></a>
</dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
</dl>

<p>Lorem Ipsum Dolor!</p>
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/class-final/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ <h1>final class</h1>
<dt class="sig sig-object php" id="typo3-cms-core-test">
<span class="sig-name modifier"><span class="pre">final</span></span> <em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\Test">
Test
</span>
<span class="pre fqn" data-fqn="\TYPO3\CMS\Core\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\TYPO3\CMS\Core">Test</span>
</span> <a class="headerlink" href="#typo3-cms-core-test" title="Permalink to this definition"></a>
</dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
</dl>

<p>Lorem Ipsum Dolor!</p>
Expand Down
18 changes: 6 additions & 12 deletions tests/integration/class-namespace-directive/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ <h1>PHP Class with current namespace from directive</h1>
<dt class="sig sig-object php" id="typo3-cms-core-testclass">
<em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\TestClass">
TestClass
</span>
<span class="pre fqn" data-fqn="\TYPO3\CMS\Core\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\TYPO3\CMS\Core">TestClass</span>
</span> <a class="headerlink" href="#typo3-cms-core-testclass" title="Permalink to this definition"></a>
</dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
</dl>

<p>Lorem Ipsum Dolor!</p>
Expand All @@ -25,16 +23,14 @@ <h1>PHP Class with current namespace from directive</h1>
<dt class="sig sig-object php" id="typo3-cms-core-anotherclass">
<em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\AnotherClass">
AnotherClass
</span>
<span class="pre fqn" data-fqn="\TYPO3\CMS\Core\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\TYPO3\CMS\Core">AnotherClass</span>
</span> <a class="headerlink" href="#typo3-cms-core-anotherclass" title="Permalink to this definition"></a>
</dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
</dl>

<p>Lorem Ipsum Dolor Another!</p>
Expand All @@ -45,16 +41,14 @@ <h1>PHP Class with current namespace from directive</h1>
<dt class="sig sig-object php" id="myvendor-some-namespace-anotherclass">
<em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\MyVendor\Some\Namespace" title="\MyVendor\Some\Namespace\AnotherClass">
AnotherClass
</span>
<span class="pre fqn" data-fqn="\MyVendor\Some\Namespace\MyVendor\Some\Namespace" title="\MyVendor\Some\Namespace\MyVendor\Some\Namespace">AnotherClass</span>
</span> <a class="headerlink" href="#myvendor-some-namespace-anotherclass" title="Permalink to this definition"></a>
</dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\MyVendor\Some\Namespace\MyVendor\Some\Namespace</span> </dd>
<span class="pre">\MyVendor\Some\Namespace\MyVendor\Some\Namespace</span> </dd>
</dl>

<p>Lorem Ipsum Dolor Yet Another!</p>
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/class-twice-noindex/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ <h1>class listed twice throws warning</h1>
<dt class="sig sig-object php" id="typo3-cms-core-test">
<em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\Test">
Test
</span>
<span class="pre fqn" data-fqn="\TYPO3\CMS\Core\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\TYPO3\CMS\Core">Test</span>
</span> <a class="headerlink" href="#typo3-cms-core-test" title="Permalink to this definition"></a>
</dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
</dl>

<p>Lorem Ipsum Dolor!</p>
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/class-twice-noindex/expected/page2.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ <h1>class listed twice throws warning</h1>
<dt class="sig sig-object php">
<em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\Test">
Test
</span>
<span class="pre fqn" data-fqn="\TYPO3\CMS\Core\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\TYPO3\CMS\Core">Test</span>
</span> </dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
</dl>

<p>Lorem Ipsum Dolor!</p>
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/class-twice-warning/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ <h1>class listed twice throws warning</h1>
<dt class="sig sig-object php" id="typo3-cms-core-test">
<em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\Test">
Test
</span>
<span class="pre fqn" data-fqn="\TYPO3\CMS\Core\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\TYPO3\CMS\Core">Test</span>
</span> <a class="headerlink" href="#typo3-cms-core-test" title="Permalink to this definition"></a>
</dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
</dl>

<p>Lorem Ipsum Dolor!</p>
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/class-twice-warning/expected/page2.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ <h1>class listed twice throws warning</h1>
<dt class="sig sig-object php" id="typo3-cms-core-test">
<em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\Test">
Test
</span>
<span class="pre fqn" data-fqn="\TYPO3\CMS\Core\TYPO3\CMS\Core" title="\TYPO3\CMS\Core\TYPO3\CMS\Core">Test</span>
</span> <a class="headerlink" href="#typo3-cms-core-test" title="Permalink to this definition"></a>
</dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
<span class="pre">\TYPO3\CMS\Core\TYPO3\CMS\Core</span> </dd>
</dl>

<p>Lorem Ipsum Dolor!</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ <h1>PHP class with constants</h1>
<dt class="sig sig-object php" id="chucklefactory-funclass">
<em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\ChuckleFactory" title="\ChuckleFactory\FunClass">
FunClass
</span>
<span class="pre fqn" data-fqn="\ChuckleFactory\ChuckleFactory" title="\ChuckleFactory\ChuckleFactory">FunClass</span>
</span> <a class="headerlink" href="#chucklefactory-funclass" title="Permalink to this definition"></a>
</dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\ChuckleFactory\ChuckleFactory</span> </dd>
<span class="pre">\ChuckleFactory\ChuckleFactory</span> </dd>
</dl>

<p>Where Fun Knows No Bounds!</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ <h1>PHP class with constants</h1>
<dt class="sig sig-object php" id="secretsociety-enigmaticclass">
<em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\SecretSociety" title="\SecretSociety\EnigmaticClass">
EnigmaticClass
</span>
<span class="pre fqn" data-fqn="\SecretSociety\SecretSociety" title="\SecretSociety\SecretSociety">EnigmaticClass</span>
</span> <a class="headerlink" href="#secretsociety-enigmaticclass" title="Permalink to this definition"></a>
</dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\SecretSociety\SecretSociety</span> </dd>
<span class="pre">\SecretSociety\SecretSociety</span> </dd>
</dl>

<p>Unveiling the mysteries of constants!</p>
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/class-with-const-link/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ <h1>PHP class with constants</h1>
<dt class="sig sig-object php" id="secretsociety-enigmaticclass">
<em class="property"><span class="pre">class</span> </em>
<span class="sig-name descname">
<span class="pre fqn" data-namespace="\SecretSociety" title="\SecretSociety\EnigmaticClass">
EnigmaticClass
</span>
<span class="pre fqn" data-fqn="\SecretSociety\SecretSociety" title="\SecretSociety\SecretSociety">EnigmaticClass</span>
</span> <a class="headerlink" href="#secretsociety-enigmaticclass" title="Permalink to this definition"></a>
</dt>
<dd>
<dl class="field-list simple">
<dt class="field-even">Fully qualified name</dt>
<dd class="field-even">
<span class="pre">\SecretSociety\SecretSociety</span> </dd>
<span class="pre">\SecretSociety\SecretSociety</span> </dd>
</dl>

<p>Unveiling the mysteries of constants!</p>
Expand Down
Loading

0 comments on commit 4740944

Please sign in to comment.