Skip to content

Commit 19d39b2

Browse files
committed
Add PHPDoc types for properties
1 parent 0c439da commit 19d39b2

17 files changed

+122
-10
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 #339: Fix processing of multidimensional arrays (mspirkov)
1313
- Enh #342: Remove unnecessary files from Composer package (mspirkov)
1414
- Enh #341: Add support for nullable types (mspirkov)
15+
- Enh #347: Add PHPDoc types for properties (mspirkov)
1516

1617

1718
3.0.8 November 24, 2025

components/BaseController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ abstract class BaseController extends Controller
3131
*/
3232
public $exclude;
3333
/**
34-
* @var string
34+
* @var string|null
3535
*/
3636
public $pageTitle;
3737

helpers/ApiMarkdown.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ApiMarkdown extends GithubMarkdown
2727
use MarkdownHighlightTrait;
2828

2929
/**
30-
* @var BaseRenderer
30+
* @var BaseRenderer|null
3131
*/
3232
public static $renderer;
3333
/**
@@ -36,7 +36,13 @@ class ApiMarkdown extends GithubMarkdown
3636
*/
3737
public static $blockTranslations = [];
3838

39+
/**
40+
* @var TypeDoc|null
41+
*/
3942
protected $renderingContext;
43+
/**
44+
* @var array
45+
*/
4046
protected $headings = [];
4147

4248

helpers/ApiMarkdownLaTeX.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ class ApiMarkdownLaTeX extends GithubMarkdown
2424
use ApiMarkdownTrait;
2525

2626
/**
27-
* @var BaseRenderer
27+
* @var BaseRenderer|null
2828
*/
2929
public static $renderer;
3030

31+
/**
32+
* @var TypeDoc|null
33+
*/
3134
protected $renderingContext;
3235

3336

helpers/IndexFileAnalyzer.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,22 @@
1515
*/
1616
class IndexFileAnalyzer extends Markdown
1717
{
18+
/**
19+
* @var string|null
20+
*/
1821
public $title;
22+
/**
23+
* @var string|null
24+
*/
1925
public $introduction;
2026

27+
/**
28+
* @var int
29+
*/
2130
private $_chapter = 0;
31+
/**
32+
* @var array
33+
*/
2234
private $_chapters = [];
2335

2436

models/BaseDoc.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,41 @@ class BaseDoc extends BaseObject
5858
* @var string|null
5959
*/
6060
public $fullName;
61+
/**
62+
* @var string|null
63+
*/
6164
public $sourceFile;
65+
/**
66+
* @var int|null
67+
*/
6268
public $startLine;
69+
/**
70+
* @var int|null
71+
*/
6372
public $endLine;
73+
/**
74+
* @var string|null
75+
*/
6476
public $shortDescription;
77+
/**
78+
* @var string|null
79+
*/
6580
public $description;
6681
/**
6782
* @var string|null Available since this version.
6883
*/
6984
public $since;
7085
/**
71-
* @var array A mapping where keys are versions and values are descriptions.
86+
* @var array<string, string> A mapping where keys are versions and values are descriptions.
7287
*/
7388
public $sinceMap = [];
89+
/**
90+
* @var string|null
91+
*/
7492
public $deprecatedSince;
93+
/**
94+
* @var string|null
95+
*/
7596
public $deprecatedReason;
7697
/**
7798
* @var Tag[]

models/InterfaceDoc.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
*/
1919
class InterfaceDoc extends TypeDoc
2020
{
21+
/**
22+
* @var string[]
23+
*/
2124
public $parentInterfaces = [];
2225
/**
2326
* @var string[] Class names

models/MethodDoc.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,21 @@
1919
*/
2020
class MethodDoc extends FunctionDoc
2121
{
22+
/**
23+
* @var bool|null
24+
*/
2225
public $isAbstract;
26+
/**
27+
* @var bool|null
28+
*/
2329
public $isFinal;
30+
/**
31+
* @var bool|null
32+
*/
2433
public $isStatic;
34+
/**
35+
* @var string|null
36+
*/
2537
public $visibility;
2638
/**
2739
* @var string|null

models/ParamDoc.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,34 @@
2020
*/
2121
class ParamDoc extends BaseObject
2222
{
23+
/**
24+
* @var string
25+
*/
2326
public $name;
27+
/**
28+
* @var bool|null
29+
*/
2430
public $isOptional;
2531
/**
2632
* @var string|null
2733
*/
2834
public $defaultValue;
35+
/**
36+
* @var bool|null
37+
*/
2938
public $isPassedByReference;
3039
// will be set by creating class
40+
/**
41+
* @var string|null
42+
*/
3143
public $description;
3244
/**
3345
* @var Type|null
3446
*/
3547
public $type;
48+
/**
49+
* @var string|null
50+
*/
3651
public $sourceFile;
3752
/**
3853
* @var FunctionDoc|MethodDoc

models/PropertyDoc.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@
2424
*/
2525
class PropertyDoc extends BaseDoc
2626
{
27+
/**
28+
* @var string|null
29+
*/
2730
public $visibility;
31+
/**
32+
* @var bool|null
33+
*/
2834
public $isStatic;
2935
/**
3036
* @var Type|null
@@ -35,7 +41,13 @@ class PropertyDoc extends BaseDoc
3541
*/
3642
public $defaultValue;
3743
// will be set by creating class
44+
/**
45+
* @var MethodDoc|null
46+
*/
3847
public $getter;
48+
/**
49+
* @var MethodDoc|null
50+
*/
3951
public $setter;
4052
/**
4153
* @var string|null

0 commit comments

Comments
 (0)