From a976e1ad36f705c774b7b0a7bc957407f0b780d4 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: Mon, 10 Nov 2025 21:51:14 +0400 Subject: [PATCH 1/4] Fix PHP8.1 `trim` deprecation error --- commands/ApiController.php | 4 ++-- models/ClassDoc.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/commands/ApiController.php b/commands/ApiController.php index bd7d6425..b584b2ed 100644 --- a/commands/ApiController.php +++ b/commands/ApiController.php @@ -31,7 +31,7 @@ class ApiController extends BaseController */ public $guidePrefix = 'guide-'; /** - * @var string Repository url (e.g. "https://github.com/yiisoft/yii2"). Optional, used for resolving relative links + * @var string|null Repository url (e.g. "https://github.com/yiisoft/yii2"). Optional, used for resolving relative links * within a repository (e.g. "[docs/guide/README.md](docs/guide/README.md)"). If you don't have such links you can * skip this. Otherwise, skipping this will cause generation of broken links because they will be not resolved and * left as is. @@ -74,7 +74,7 @@ public function actionIndex(array $sourceDirs, $targetDir) } } - $renderer->repoUrl = rtrim($this->repoUrl, '/'); + $renderer->repoUrl = $this->repoUrl !== null ? rtrim($this->repoUrl, '/') : null; // search for files to process if (($files = $this->searchFiles($sourceDirs)) === false) { diff --git a/models/ClassDoc.php b/models/ClassDoc.php index 4916c69f..c68cb1c4 100644 --- a/models/ClassDoc.php +++ b/models/ClassDoc.php @@ -18,7 +18,7 @@ class ClassDoc extends TypeDoc { /** - * @var string + * @var string|null */ public $parentClass; /** @@ -101,7 +101,8 @@ public function __construct($reflector = null, $context = null, $config = []) return; } - $this->parentClass = ltrim($reflector->getParent(), '\\'); + $reflectorParent = $reflector->getParent(); + $this->parentClass = $reflectorParent !== null ? ltrim($reflectorParent, '\\') : null; if (empty($this->parentClass)) { $this->parentClass = null; } From 06b5d692d104f899534cee8cdd10d2289ebee478 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: Mon, 10 Nov 2025 21:55:18 +0400 Subject: [PATCH 2/4] changelog + build --- .github/workflows/build.yml | 2 +- CHANGELOG.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9e05c03..ecd5af1a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - php: ['7.2', '7.3', '7.4', '8.0'] + php: ['7.2', '7.3', '7.4', '8.0', '8.1'] steps: - name: Checkout diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f473f6a..f8d7b57a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Yii Framework 2 apidoc extension Change Log ----------------------- - Bug #313: Fix deprecation error `Method deprecated, use ::getParameters()` (mspirkov) +- Bug #317: Fix `trim` deprecation error `Passing null to parameter #1 ($string) of type string is deprecated` (mspirkov) 3.0.7 February 13, 2025 From bf8dc068ded68ab62047f5ee7af206bc2d941df3 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: Mon, 10 Nov 2025 21:59:31 +0400 Subject: [PATCH 3/4] phpunit version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0f8a2577..bac01dc7 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "scrivo/highlight.php": "^9.0" }, "require-dev": { - "phpunit/phpunit": "*" + "phpunit/phpunit": "^8.5" }, "repositories": [ { From 7fe967b5a83cf6021ec086e1cd34015676a4f653 Mon Sep 17 00:00:00 2001 From: Maksim Spirkov <63721828+mspirkov@users.noreply.github.com> Date: Mon, 10 Nov 2025 22:06:50 +0400 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8d7b57a..1c754680 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ Yii Framework 2 apidoc extension Change Log ----------------------- - Bug #313: Fix deprecation error `Method deprecated, use ::getParameters()` (mspirkov) -- Bug #317: Fix `trim` deprecation error `Passing null to parameter #1 ($string) of type string is deprecated` (mspirkov) +- Bug #317: Fix `trim` deprecation errors `Passing null to parameter #1 ($string) of type string is deprecated` (mspirkov) 3.0.7 February 13, 2025