Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v5
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -26,7 +26,7 @@ jobs:
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# netbeans project files
nbproject

# visual studio code project files
.vscode

# zend studio for eclipse project files
.buildpath
.project
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Yii Framework 2 apidoc extension Change Log
3.0.8 under development
-----------------------

- no changes in this release.
- Bug #314: Fix deprecation error `Method deprecated, use ::getParameters()` (mspirkov)


3.0.7 February 13, 2025
Expand Down
6 changes: 3 additions & 3 deletions models/TypeDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,12 @@ public function __construct($reflector = null, $context = null, $config = [])
if ($tag instanceof Method) {
$params = [];

foreach ($tag->getArguments() as $tagArgument) {
$argumentType = (string) $tagArgument['type'];
foreach ($tag->getParameters() as $parameter) {
$argumentType = (string) $parameter->getType();

$params[] = new ParamDoc(null, $context, [
'sourceFile' => $this->sourceFile,
'name' => $tagArgument['name'],
'name' => $parameter->getName(),
'typeHint' => $argumentType,
'type' => $argumentType,
'types' => [],
Expand Down
25 changes: 25 additions & 0 deletions tests/commands/ApiControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,31 @@ public function testGenerateBootstrap()
, $animalContent
);

$this->assertContainsWithoutIndent(
<<<HTML
<tr id="isOlder()" class="">
<td><a href="yiiunit-apidoc-data-api-animal-animal.html#isOlder()-detail">isOlder()</a></td>
<td>Checks whether the animal is older than the specified time.</td>
<td><a href="yiiunit-apidoc-data-api-animal-animal.html">yiiunit\apidoc\data\api\animal\Animal</a></td>
</tr>
HTML
, $animalContent
);

$this->assertContainsWithoutIndent(
<<<HTML
<tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="https://www.php.net/language.types.boolean">boolean</a></span> <strong><a href="yiiunit-apidoc-data-api-animal-animal.html#isOlder()-detail">isOlder</a></strong> ( <span style="color: #0000BB">\$date</span> )</td></tr>
<tr>
<td class="param-name-col"><span style="color: #0000BB">\$date</span></td>
<td class="param-type-col"><a href="https://www.php.net/language.types.integer">integer</a></td>
<td class="param-desc-col">
<p>Date as a UNIX timestamp.</p>
</td>
</tr>
HTML
, $animalContent
);

// Class `Dog` :
$dogFile = $outputPath . DIRECTORY_SEPARATOR . 'yiiunit-apidoc-data-api-animal-dog.html';
$this->assertTrue(file_exists($dogFile));
Expand Down
10 changes: 10 additions & 0 deletions tests/data/api/animal/Animal.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,14 @@ public function getAge()
{
return time() - $this->birthDate;
}

/**
* Checks whether the animal is older than the specified time.
* @param int $date date as a UNIX timestamp.
* @return bool
*/
public function isOlder($date)
{
return $this->getAge() > $date;
}
}
Loading