From 4715068996b266458859699511731574d81e039b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Sun, 2 Nov 2025 12:24:59 +0400 Subject: [PATCH 1/5] Fix deprecation `Method deprecated, use ::getParameters()` --- .gitignore | 3 +++ models/TypeDoc.php | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 9ca9e4a4..fa9a7ab6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ # netbeans project files nbproject +# visual studio code project files +.vscode + # zend studio for eclipse project files .buildpath .project diff --git a/models/TypeDoc.php b/models/TypeDoc.php index 23b32f8c..a064a98c 100644 --- a/models/TypeDoc.php +++ b/models/TypeDoc.php @@ -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' => [], From 09aab99c84b25be694482f436900c0ab50e5ede9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Sun, 2 Nov 2025 12:27:03 +0400 Subject: [PATCH 2/5] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8ca2626..2a365c0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Yii Framework 2 apidoc extension Change Log 3.0.8 under development ----------------------- -- no changes in this release. +- Bug #311: Fix deprecation error `Method deprecated, use ::getParameters()` (mspirkov) 3.0.7 February 13, 2025 From 04ea745892672cbdecdb574832e7b27d6318f4b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Sun, 2 Nov 2025 12:33:47 +0400 Subject: [PATCH 3/5] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a365c0c..bc8b4510 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Yii Framework 2 apidoc extension Change Log 3.0.8 under development ----------------------- -- Bug #311: Fix deprecation error `Method deprecated, use ::getParameters()` (mspirkov) +- Bug #314: Fix deprecation error `Method deprecated, use ::getParameters()` (mspirkov) 3.0.7 February 13, 2025 From 12ad5f686b1ca812758b8f8fd8fbe0e95228e3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Sun, 2 Nov 2025 13:43:49 +0400 Subject: [PATCH 4/5] fix build --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02df822e..f9e05c03 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: @@ -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') }} From 6c1eafd44662bcf316120ac95772ecf38937e9ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Sun, 2 Nov 2025 19:13:17 +0400 Subject: [PATCH 5/5] add tests --- tests/commands/ApiControllerTest.php | 25 +++++++++++++++++++++++++ tests/data/api/animal/Animal.php | 10 ++++++++++ 2 files changed, 35 insertions(+) diff --git a/tests/commands/ApiControllerTest.php b/tests/commands/ApiControllerTest.php index 3354e0b8..01b857e0 100644 --- a/tests/commands/ApiControllerTest.php +++ b/tests/commands/ApiControllerTest.php @@ -118,6 +118,31 @@ public function testGenerateBootstrap() , $animalContent ); + $this->assertContainsWithoutIndent( + << + isOlder() + Checks whether the animal is older than the specified time. + yiiunit\apidoc\data\api\animal\Animal + +HTML + , $animalContent + ); + + $this->assertContainsWithoutIndent( + <<public boolean isOlder ( \$date ) + + \$date + integer + +

Date as a UNIX timestamp.

+ + +HTML + , $animalContent + ); + // Class `Dog` : $dogFile = $outputPath . DIRECTORY_SEPARATOR . 'yiiunit-apidoc-data-api-animal-dog.html'; $this->assertTrue(file_exists($dogFile)); diff --git a/tests/data/api/animal/Animal.php b/tests/data/api/animal/Animal.php index d4ee4772..baf4a123 100644 --- a/tests/data/api/animal/Animal.php +++ b/tests/data/api/animal/Animal.php @@ -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; + } }