77class PhpDoc
88{
99
10- private string $ annotation ;
10+ private ? string $ annotation = null ;
1111
12- private string $ type ;
12+ private ? string $ type = null ;
1313
14- private string $ variable ;
14+ private ? string $ variable = null ;
1515
16- private string $ enum ;
16+ private ? string $ enum = null ;
1717
18- private ?string $ default ;
18+ private ?string $ default = null ;
1919
20- private bool $ virtual ;
20+ private bool $ virtual = false ;
2121
22- private bool $ primary ;
22+ private bool $ primary = false ;
2323
2424 private ?PhpRelDoc $ relation = null ;
2525
26- public function getAnnotation (): string
26+ public function getAnnotation (): ? string
2727 {
2828 return $ this ->annotation ;
2929 }
@@ -33,7 +33,7 @@ public function setAnnotation(string $annotation): void
3333 $ this ->annotation = $ annotation ;
3434 }
3535
36- public function getType (): string
36+ public function getType (): ? string
3737 {
3838 return $ this ->type ;
3939 }
@@ -43,7 +43,7 @@ public function setType(string $type): void
4343 $ this ->type = $ type ;
4444 }
4545
46- public function getVariable (): string
46+ public function getVariable (): ? string
4747 {
4848 return $ this ->variable ;
4949 }
@@ -53,7 +53,7 @@ public function setVariable(string $variable): void
5353 $ this ->variable = $ variable ;
5454 }
5555
56- public function getEnum (): string
56+ public function getEnum (): ? string
5757 {
5858 return $ this ->enum ;
5959 }
@@ -108,7 +108,7 @@ public function __toString(): string
108108 $ b = new DocBuilder ();
109109
110110 // Anotation (@..)
111- if ($ this ->annotation !== '' ) {
111+ if ($ this ->annotation !== null && $ this -> annotation !== '' ) {
112112 $ b ->append ($ this ->annotation );
113113 } else {
114114 if ($ this ->virtual ) {
@@ -119,7 +119,9 @@ public function __toString(): string
119119 }
120120
121121 // Type (int, string..)
122- $ b ->append ($ this ->type );
122+ if ($ this ->type !== null ) {
123+ $ b ->append ($ this ->type );
124+ }
123125
124126 // Variable ($..)
125127 $ b ->append (sprintf ('$%s ' , $ this ->variable ));
0 commit comments