Skip to content

Commit a635a4f

Browse files
authored
Fix #327: Fix deprecation errors The expression value will become of type Expression by default
1 parent d96841b commit a635a4f

File tree

6 files changed

+172
-4
lines changed

6 files changed

+172
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Yii Framework 2 apidoc extension Change Log
1212
- Bug #311: Support `nikic/php-parser` v5 (mspirkov)
1313
- Bug #324: Raise minimum PHP version to 7.4 (mspirkov)
1414
- Bug #325: Fix deprecation errors `The Default value will become of type Expression by default` (mspirkov)
15+
- Bug #327: Fix deprecation errors `The expression value will become of type Expression by default` (mspirkov)
1516

1617

1718
3.0.7 February 13, 2025

models/ConstDoc.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @link https://www.yiiframework.com/
45
* @copyright Copyright (c) 2008 Yii Software LLC
@@ -19,6 +20,9 @@
1920
class ConstDoc extends BaseDoc
2021
{
2122
public $definedBy;
23+
/**
24+
* @var string|null
25+
*/
2226
public $value;
2327

2428

@@ -36,6 +40,11 @@ public function __construct($reflector = null, $context = null, $config = [], $d
3640
return;
3741
}
3842

39-
$this->value = $reflector->getValue();
43+
if (PHP_VERSION_ID >= 80100) {
44+
$reflectorValue = $reflector->getValue(false);
45+
$this->value = $reflectorValue !== null ? (string) $reflectorValue : null;
46+
} else {
47+
$this->value = $reflector->getValue();
48+
}
4049
}
4150
}

tests/commands/__snapshots__/ApiControllerTest__testGenerateBootstrap__1.html

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ <h1>Abstract Class yiiunit\apidoc\data\api\animal\Animal</h1>
5050
<a href="index">All Classes</a>
5151
| <a>Properties</a>
5252
| <a>Methods</a>
53-
</div>
53+
| <a>Constants</a>
54+
</div>
5455

5556
<table class="summaryTable docClass table table-bordered">
5657
<colgroup>
@@ -187,6 +188,55 @@ <h2>Public Methods</h2>
187188

188189
<a></a>
189190

191+
<div class="doc-const summary toggle-target-container">
192+
<h2>Constants</h2>
193+
194+
<p><a class="toggle">Hide inherited constants</a></p>
195+
196+
<table class="summary-table table table-striped table-bordered table-hover">
197+
<colgroup>
198+
<col class="col-const">
199+
<col class="col-value">
200+
<col class="col-description">
201+
<col class="col-defined">
202+
</colgroup>
203+
<tr>
204+
<th>Constant</th>
205+
<th>Value</th>
206+
<th>Description</th>
207+
<th>Defined By</th>
208+
</tr>
209+
210+
<tr class="">
211+
<td>COLORS</td>
212+
<td>[
213+
self::COLOR_GREY,
214+
self::COLOR_WHITE,
215+
]</td>
216+
<td>
217+
218+
</td>
219+
<td><a href="yiiunit-apidoc-data-api-animal-animal.html">yiiunit\apidoc\data\api\animal\Animal</a></td>
220+
</tr>
221+
<tr class="">
222+
<td>COLOR_GREY</td>
223+
<td>'grey'</td>
224+
<td>
225+
226+
</td>
227+
<td><a href="yiiunit-apidoc-data-api-animal-animal.html">yiiunit\apidoc\data\api\animal\Animal</a></td>
228+
</tr>
229+
<tr class="">
230+
<td>COLOR_WHITE</td>
231+
<td>'white'</td>
232+
<td>
233+
234+
</td>
235+
<td><a href="yiiunit-apidoc-data-api-animal-animal.html">yiiunit\apidoc\data\api\animal\Animal</a></td>
236+
</tr>
237+
</table>
238+
</div>
239+
190240

191241
<h2>Property Details</h2>
192242

tests/commands/__snapshots__/ApiControllerTest__testGenerateBootstrap__2.html

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ <h1>Class yiiunit\apidoc\data\api\animal\Cat</h1>
5050
<a href="index">All Classes</a>
5151
| <a>Properties</a>
5252
| <a>Methods</a>
53-
</div>
53+
| <a>Constants</a>
54+
</div>
5455

5556
<table class="summaryTable docClass table table-bordered">
5657
<colgroup>
@@ -187,6 +188,55 @@ <h2>Public Methods</h2>
187188

188189
<a></a>
189190

191+
<div class="doc-const summary toggle-target-container">
192+
<h2>Constants</h2>
193+
194+
<p><a class="toggle">Hide inherited constants</a></p>
195+
196+
<table class="summary-table table table-striped table-bordered table-hover">
197+
<colgroup>
198+
<col class="col-const">
199+
<col class="col-value">
200+
<col class="col-description">
201+
<col class="col-defined">
202+
</colgroup>
203+
<tr>
204+
<th>Constant</th>
205+
<th>Value</th>
206+
<th>Description</th>
207+
<th>Defined By</th>
208+
</tr>
209+
210+
<tr class="inherited">
211+
<td>COLORS</td>
212+
<td>[
213+
self::COLOR_GREY,
214+
self::COLOR_WHITE,
215+
]</td>
216+
<td>
217+
218+
</td>
219+
<td><a href="yiiunit-apidoc-data-api-animal-animal.html">yiiunit\apidoc\data\api\animal\Animal</a></td>
220+
</tr>
221+
<tr class="inherited">
222+
<td>COLOR_GREY</td>
223+
<td>'grey'</td>
224+
<td>
225+
226+
</td>
227+
<td><a href="yiiunit-apidoc-data-api-animal-animal.html">yiiunit\apidoc\data\api\animal\Animal</a></td>
228+
</tr>
229+
<tr class="inherited">
230+
<td>COLOR_WHITE</td>
231+
<td>'white'</td>
232+
<td>
233+
234+
</td>
235+
<td><a href="yiiunit-apidoc-data-api-animal-animal.html">yiiunit\apidoc\data\api\animal\Animal</a></td>
236+
</tr>
237+
</table>
238+
</div>
239+
190240

191241
<h2>Method Details</h2>
192242

tests/commands/__snapshots__/ApiControllerTest__testGenerateBootstrap__3.html

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ <h1>Class yiiunit\apidoc\data\api\animal\Dog</h1>
5050
<a href="index">All Classes</a>
5151
| <a>Properties</a>
5252
| <a>Methods</a>
53-
</div>
53+
| <a>Constants</a>
54+
</div>
5455

5556
<table class="summaryTable docClass table table-bordered">
5657
<colgroup>
@@ -182,6 +183,55 @@ <h2>Public Methods</h2>
182183

183184
<a></a>
184185

186+
<div class="doc-const summary toggle-target-container">
187+
<h2>Constants</h2>
188+
189+
<p><a class="toggle">Hide inherited constants</a></p>
190+
191+
<table class="summary-table table table-striped table-bordered table-hover">
192+
<colgroup>
193+
<col class="col-const">
194+
<col class="col-value">
195+
<col class="col-description">
196+
<col class="col-defined">
197+
</colgroup>
198+
<tr>
199+
<th>Constant</th>
200+
<th>Value</th>
201+
<th>Description</th>
202+
<th>Defined By</th>
203+
</tr>
204+
205+
<tr class="inherited">
206+
<td>COLORS</td>
207+
<td>[
208+
self::COLOR_GREY,
209+
self::COLOR_WHITE,
210+
]</td>
211+
<td>
212+
213+
</td>
214+
<td><a href="yiiunit-apidoc-data-api-animal-animal.html">yiiunit\apidoc\data\api\animal\Animal</a></td>
215+
</tr>
216+
<tr class="inherited">
217+
<td>COLOR_GREY</td>
218+
<td>'grey'</td>
219+
<td>
220+
221+
</td>
222+
<td><a href="yiiunit-apidoc-data-api-animal-animal.html">yiiunit\apidoc\data\api\animal\Animal</a></td>
223+
</tr>
224+
<tr class="inherited">
225+
<td>COLOR_WHITE</td>
226+
<td>'white'</td>
227+
<td>
228+
229+
</td>
230+
<td><a href="yiiunit-apidoc-data-api-animal-animal.html">yiiunit\apidoc\data\api\animal\Animal</a></td>
231+
</tr>
232+
</table>
233+
</div>
234+
185235

186236
<h2>Method Details</h2>
187237

tests/data/api/animal/Animal.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
*/
2222
abstract class Animal extends BaseObject
2323
{
24+
public const COLOR_GREY = 'grey';
25+
public const COLOR_WHITE = 'white';
26+
27+
public const COLORS = [
28+
self::COLOR_GREY,
29+
self::COLOR_WHITE,
30+
];
31+
2432
/**
2533
* @var string animal name.
2634
*/

0 commit comments

Comments
 (0)