Skip to content

Commit a112142

Browse files
authored
Fix #317: Fix trim deprecation errors Passing null to parameter #1 ($string) of type string is deprecated
1 parent b9550d8 commit a112142

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [ubuntu-latest]
16-
php: ['7.2', '7.3', '7.4', '8.0']
16+
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
1717

1818
steps:
1919
- name: Checkout

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Yii Framework 2 apidoc extension Change Log
55
-----------------------
66

77
- Bug #313: Fix deprecation error `Method deprecated, use ::getParameters()` (mspirkov)
8+
- Bug #317: Fix `trim` deprecation errors `Passing null to parameter #1 ($string) of type string is deprecated` (mspirkov)
89

910

1011
3.0.7 February 13, 2025

commands/ApiController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ApiController extends BaseController
3131
*/
3232
public $guidePrefix = 'guide-';
3333
/**
34-
* @var string Repository url (e.g. "https://github.com/yiisoft/yii2"). Optional, used for resolving relative links
34+
* @var string|null Repository url (e.g. "https://github.com/yiisoft/yii2"). Optional, used for resolving relative links
3535
* within a repository (e.g. "[docs/guide/README.md](docs/guide/README.md)"). If you don't have such links you can
3636
* skip this. Otherwise, skipping this will cause generation of broken links because they will be not resolved and
3737
* left as is.
@@ -74,7 +74,7 @@ public function actionIndex(array $sourceDirs, $targetDir)
7474
}
7575
}
7676

77-
$renderer->repoUrl = rtrim($this->repoUrl, '/');
77+
$renderer->repoUrl = $this->repoUrl !== null ? rtrim($this->repoUrl, '/') : null;
7878

7979
// search for files to process
8080
if (($files = $this->searchFiles($sourceDirs)) === false) {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"scrivo/highlight.php": "^9.0"
3333
},
3434
"require-dev": {
35-
"phpunit/phpunit": "*"
35+
"phpunit/phpunit": "^8.5"
3636
},
3737
"repositories": [
3838
{

models/ClassDoc.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class ClassDoc extends TypeDoc
1919
{
2020
/**
21-
* @var string
21+
* @var string|null
2222
*/
2323
public $parentClass;
2424
/**
@@ -101,7 +101,8 @@ public function __construct($reflector = null, $context = null, $config = [])
101101
return;
102102
}
103103

104-
$this->parentClass = ltrim($reflector->getParent(), '\\');
104+
$reflectorParent = $reflector->getParent();
105+
$this->parentClass = $reflectorParent !== null ? ltrim($reflectorParent, '\\') : null;
105106
if (empty($this->parentClass)) {
106107
$this->parentClass = null;
107108
}

0 commit comments

Comments
 (0)