Skip to content

Commit 0ad57b6

Browse files
authored
Fix #329: Fix getting parameter types from the @method annotation
1 parent 0b65f00 commit 0ad57b6

File tree

6 files changed

+27
-8
lines changed

6 files changed

+27
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Yii Framework 2 apidoc extension Change Log
1313
- Bug #324: Raise minimum PHP version to 7.4 (mspirkov)
1414
- Bug #325: Fix deprecation errors `The Default value will become of type Expression by default` (mspirkov)
1515
- Bug #327: Fix deprecation errors `The expression value will become of type Expression by default` (mspirkov)
16+
- Bug #329: Fix getting parameter types from the `@method` annotation (mspirkov)
1617

1718

1819
3.0.7 February 13, 2025

models/TypeDoc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function __construct($reflector = null, $context = null, $config = [])
231231
'name' => $parameter->getName(),
232232
'typeHint' => $argumentType,
233233
'type' => $argumentType,
234-
'types' => [],
234+
'types' => [$argumentType],
235235
]);
236236
}
237237

tests/commands/__snapshots__/ApiControllerTest__testGenerateBootstrap__1.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,11 +437,17 @@ <h2>Method Details</h2>
437437

438438
<table class="detail-table table table-striped table-bordered table-hover">
439439
<tr><td colspan="3" class="signature">
440-
<span class="signature-defs">public</span> <span class="signature-type"><a href="https://www.php.net/language.types.integer">integer</a></span> <strong><a href="yiiunit-apidoc-data-api-animal-animal.html#getSomething()-detail">getSomething</a></strong> ( <span style="color: #0000BB">$test</span> )</td></tr>
440+
<span class="signature-defs">public</span> <span class="signature-type"><a href="https://www.php.net/language.types.integer">integer</a></span> <strong><a href="yiiunit-apidoc-data-api-animal-animal.html#getSomething()-detail">getSomething</a></strong> ( <span style="color: #0000BB">$test</span>, <span class="signature-type"><a href="https://www.php.net/language.types.integer">integer</a></span> <span style="color: #0000BB">$test2</span> )</td></tr>
441441

442442
<tr>
443443
<td class="param-name-col"><span style="color: #0000BB">$test</span></td>
444-
<td class="param-type-col"></td>
444+
<td class="param-type-col"><a href="https://www.php.net/language.types.mixed">mixed</a></td>
445+
<td class="param-desc-col">
446+
</td>
447+
</tr>
448+
<tr>
449+
<td class="param-name-col"><span style="color: #0000BB">$test2</span></td>
450+
<td class="param-type-col"><a href="https://www.php.net/language.types.integer">integer</a></td>
445451
<td class="param-desc-col">
446452
</td>
447453
</tr>

tests/commands/__snapshots__/ApiControllerTest__testGenerateBootstrap__2.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,17 @@ <h2>Method Details</h2>
323323

324324
<table class="detail-table table table-striped table-bordered table-hover">
325325
<tr><td colspan="3" class="signature">
326-
<span class="signature-defs">public</span> <span class="signature-type"><a href="https://www.php.net/language.types.integer">integer</a></span> <strong><a href="yiiunit-apidoc-data-api-animal-animal.html#getSomething()-detail">getSomething</a></strong> ( <span style="color: #0000BB">$test</span> )</td></tr>
326+
<span class="signature-defs">public</span> <span class="signature-type"><a href="https://www.php.net/language.types.integer">integer</a></span> <strong><a href="yiiunit-apidoc-data-api-animal-animal.html#getSomething()-detail">getSomething</a></strong> ( <span style="color: #0000BB">$test</span>, <span class="signature-type"><a href="https://www.php.net/language.types.integer">integer</a></span> <span style="color: #0000BB">$test2</span> )</td></tr>
327327

328328
<tr>
329329
<td class="param-name-col"><span style="color: #0000BB">$test</span></td>
330-
<td class="param-type-col"></td>
330+
<td class="param-type-col"><a href="https://www.php.net/language.types.mixed">mixed</a></td>
331+
<td class="param-desc-col">
332+
</td>
333+
</tr>
334+
<tr>
335+
<td class="param-name-col"><span style="color: #0000BB">$test2</span></td>
336+
<td class="param-type-col"><a href="https://www.php.net/language.types.integer">integer</a></td>
331337
<td class="param-desc-col">
332338
</td>
333339
</tr>

tests/commands/__snapshots__/ApiControllerTest__testGenerateBootstrap__3.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,17 @@ <h2>Method Details</h2>
318318

319319
<table class="detail-table table table-striped table-bordered table-hover">
320320
<tr><td colspan="3" class="signature">
321-
<span class="signature-defs">public</span> <span class="signature-type"><a href="https://www.php.net/language.types.integer">integer</a></span> <strong><a href="yiiunit-apidoc-data-api-animal-animal.html#getSomething()-detail">getSomething</a></strong> ( <span style="color: #0000BB">$test</span> )</td></tr>
321+
<span class="signature-defs">public</span> <span class="signature-type"><a href="https://www.php.net/language.types.integer">integer</a></span> <strong><a href="yiiunit-apidoc-data-api-animal-animal.html#getSomething()-detail">getSomething</a></strong> ( <span style="color: #0000BB">$test</span>, <span class="signature-type"><a href="https://www.php.net/language.types.integer">integer</a></span> <span style="color: #0000BB">$test2</span> )</td></tr>
322322

323323
<tr>
324324
<td class="param-name-col"><span style="color: #0000BB">$test</span></td>
325-
<td class="param-type-col"></td>
325+
<td class="param-type-col"><a href="https://www.php.net/language.types.mixed">mixed</a></td>
326+
<td class="param-desc-col">
327+
</td>
328+
</tr>
329+
<tr>
330+
<td class="param-name-col"><span style="color: #0000BB">$test2</span></td>
331+
<td class="param-type-col"><a href="https://www.php.net/language.types.integer">integer</a></td>
326332
<td class="param-desc-col">
327333
</td>
328334
</tr>

tests/data/api/animal/Animal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @property int $age animal age in seconds.
1616
*
17-
* @method int getSomething($test)
17+
* @method int getSomething($test, int $test2)
1818
*
1919
* @author Paul Klimov <[email protected]>
2020
* @since 1.0

0 commit comments

Comments
 (0)