-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve type tag linking behaviour (#94)
Also add proper support for void element and add a test case to the appropriate files. --------- Co-authored-by: haszi <haszika80@gmail.com>
- Loading branch information
Showing
9 changed files
with
762 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
tests/php/data/type_rendering_constructorsynopsis_parameters-and-return-type.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<chapter xml:id="type-rendering-constructorsynopsis-parameters-and-return-type"> | ||
|
||
<section> | ||
<para>1. Constructor with no parameters, no return type</para> | ||
<constructorsynopsis> | ||
<modifier>final</modifier> <modifier>public</modifier> <methodname>ClassName::__construct</methodname> | ||
</constructorsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>2. Constructor with no parameters, void (element) return type</para> | ||
<constructorsynopsis> | ||
<modifier>final</modifier> <modifier>public</modifier> <methodname>ClassName::__construct</methodname> | ||
<void/> | ||
</constructorsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>3. Constructor with one parameter</para> | ||
<constructorsynopsis> | ||
<modifier>final</modifier> <modifier>private</modifier> <methodname>ClassName::__construct</methodname> | ||
<methodparam><type>mixed</type><parameter>anything</parameter></methodparam> | ||
</constructorsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>4. Constructor with optional parameter</para> | ||
<constructorsynopsis> | ||
<modifier>final</modifier> <modifier>protected</modifier> <methodname>ClassName::__construct</methodname> | ||
<methodparam choice="opt"><type>int</type><parameter>count</parameter><initializer>0</initializer></methodparam> | ||
</constructorsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>5. Constructor with nullable parameter</para> | ||
<constructorsynopsis> | ||
<modifier>final</modifier> <modifier>public</modifier> <methodname>ClassName::__construct</methodname> | ||
<methodparam><type class="union"><type>float</type><type>null</type></type><parameter>value</parameter></methodparam> | ||
</constructorsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>6. Constructor with nullable optional parameter</para> | ||
<constructorsynopsis> | ||
<modifier>final</modifier> <modifier>private</modifier> <methodname>ClassName::__construct</methodname> | ||
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>options</parameter><initializer>""</initializer></methodparam> | ||
</constructorsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>7. Constructor with reference parameter</para> | ||
<constructorsynopsis> | ||
<modifier>final</modifier> <modifier>protected</modifier> <methodname>ClassName::__construct</methodname> | ||
<methodparam><type>array</type><parameter role="reference">reference</parameter></methodparam> | ||
</constructorsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>8. Constructor with union type parameter</para> | ||
<constructorsynopsis> | ||
<modifier>final</modifier> <modifier>public</modifier> <methodname>ClassName::__construct</methodname> | ||
<methodparam><type class="union"><type>iterable</type><type>resource</type><type>callable</type><type>null</type></type><parameter>option</parameter></methodparam> | ||
</constructorsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>9. Constructor with intersection type parameter</para> | ||
<constructorsynopsis> | ||
<modifier>final</modifier> <modifier>public</modifier> <methodname>ClassName::__construct</methodname> | ||
<methodparam><type class="intersection"><type>Countable</type><type>Traversable</type></type><parameter>option</parameter></methodparam> | ||
</constructorsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>10. Constructor with DNF (Disjunctive Normal Form) type parameter</para> | ||
<constructorsynopsis> | ||
<modifier>final</modifier> <modifier>public</modifier> <methodname>ClassName::__construct</methodname> | ||
<methodparam><type class="union"><type class="intersection"><type>Countable</type><type>Traversable</type></type><type>DOMAttr</type></type><parameter>option</parameter></methodparam> | ||
</constructorsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>11. Constructor with more than three parameters</para> | ||
<constructorsynopsis> | ||
<modifier>final</modifier> <modifier>private</modifier> <methodname>ClassName::__construct</methodname> | ||
<methodparam><type>int</type><parameter>count</parameter></methodparam> | ||
<methodparam><type>string</type><parameter>name</parameter></methodparam> | ||
<methodparam><type>bool</type><parameter>isSomething</parameter></methodparam> | ||
<methodparam><type>array</type><parameter>list</parameter></methodparam> | ||
</constructorsynopsis> | ||
</section> | ||
|
||
</chapter> |
86 changes: 86 additions & 0 deletions
86
tests/php/data/type_rendering_methodsynopsis_parameters.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<chapter xml:id="type-rendering-methodsynopsis-parameters"> | ||
|
||
<section> | ||
<para>1. Function/method with no parameters</para> | ||
<methodsynopsis> | ||
<methodname>function_name</methodname> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>2. Function/method with one parameter</para> | ||
<methodsynopsis> | ||
<methodname>function_name</methodname> | ||
<methodparam><type>mixed</type><parameter>anything</parameter></methodparam> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>3. Function/method with optional parameter</para> | ||
<methodsynopsis> | ||
<methodname>function_name</methodname> | ||
<methodparam choice="opt"><type>int</type><parameter>count</parameter><initializer>0</initializer></methodparam> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>4. Function/method with nullable parameter</para> | ||
<methodsynopsis> | ||
<methodname>function_name</methodname> | ||
<methodparam><type class="union"><type>float</type><type>null</type></type><parameter>value</parameter></methodparam> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>5. Function/method with nullable optional parameter</para> | ||
<methodsynopsis> | ||
<methodname>function_name</methodname> | ||
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>options</parameter><initializer>""</initializer></methodparam> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>6. Function/method with reference parameter</para> | ||
<methodsynopsis> | ||
<methodname>function_name</methodname> | ||
<methodparam><type>array</type><parameter role="reference">reference</parameter></methodparam> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>7. Function/method with union type parameter</para> | ||
<methodsynopsis> | ||
<methodname>function_name</methodname> | ||
<methodparam><type class="union"><type>iterable</type><type>resource</type><type>callable</type><type>null</type></type><parameter>option</parameter></methodparam> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>8. Function/method with intersection type parameter</para> | ||
<methodsynopsis> | ||
<methodname>function_name</methodname> | ||
<methodparam><type class="intersection"><type>Countable</type><type>Traversable</type></type><parameter>option</parameter></methodparam> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>9. Function/method with DNF (Disjunctive Normal Form) type parameter</para> | ||
<methodsynopsis> | ||
<methodname>function_name</methodname> | ||
<methodparam><type class="union"><type class="intersection"><type>Countable</type><type>Traversable</type></type><type>DOMAttr</type></type><parameter>option</parameter></methodparam> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>10. Function/method with more than three parameters</para> | ||
<methodsynopsis> | ||
<methodname>function_name</methodname> | ||
<methodparam><type>int</type><parameter>count</parameter></methodparam> | ||
<methodparam><type>string</type><parameter>name</parameter></methodparam> | ||
<methodparam><type>bool</type><parameter>isSomething</parameter></methodparam> | ||
<methodparam><type>array</type><parameter>list</parameter></methodparam> | ||
</methodsynopsis> | ||
</section> | ||
|
||
</chapter> |
75 changes: 75 additions & 0 deletions
75
tests/php/data/type_rendering_methodsynopsis_return_types.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<chapter xml:id="type-rendering-methodsynopsis-return-types"> | ||
|
||
<section> | ||
<para>1. Function/method with no return type</para> | ||
<methodsynopsis> | ||
<methodname>function_name</methodname> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>2. Function/method with one return type - never</para> | ||
<methodsynopsis> | ||
<type>never</type><methodname>function_name</methodname> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>3. Function/method with one return type - void</para> | ||
<methodsynopsis> | ||
<type>void</type><methodname>function_name</methodname> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>4. Function/method with one return type - void element</para> | ||
<methodsynopsis> | ||
<methodname>function_name</methodname> | ||
<void/> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>5. Function/method with one return type - mixed</para> | ||
<methodsynopsis> | ||
<type>mixed</type><methodname>function_name</methodname> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>6. Function/method with union return type</para> | ||
<methodsynopsis> | ||
<type class="union"><type>int</type><type>float</type><type>false</type></type><methodname>function_name</methodname> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>7. Function/method with nullable return type</para> | ||
<methodsynopsis> | ||
<type class="union"><type>object</type><type>null</type></type><methodname>function_name</methodname> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>8. Function/method with nullable union return type</para> | ||
<methodsynopsis> | ||
<type class="union"><type>string</type><type>array</type><type>resource</type><type>callable</type><type>iterable</type><type>true</type><type>null</type></type><methodname>function_name</methodname> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>9. Function/method with unknown return type</para> | ||
<methodsynopsis> | ||
<type>UnknownType</type><methodname>function_name</methodname> | ||
</methodsynopsis> | ||
</section> | ||
<!-- TODO: fix known class return type - need to add a class to the index | ||
<section role="description"> | ||
<para>10. Function/method with known class return type</para> | ||
<methodsynopsis> | ||
<type>stdClass</type><methodname>function_name</methodname> | ||
</methodsynopsis> | ||
</section> | ||
--> | ||
</chapter> |
Oops, something went wrong.