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..1c754680 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 errors `Passing null to parameter #1 ($string) of type string is deprecated` (mspirkov) 3.0.7 February 13, 2025 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/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": [ { 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; }