@@ -6,22 +6,14 @@ class PhpType {
66 private string $ meta ;
77 private array $ namespace ;
88 private string $ alias ;
9+ private bool $ nullable ;
910
10- public function __construct (array $ namespace , string $ meta , string $ name , $ alias = null ) {
11+ public function __construct (array $ namespace , string $ meta , string $ name , $ alias = null , bool $ nullable = false ) {
1112 $ this ->namespace = $ namespace ;
1213 $ this ->meta = $ meta ;
1314 $ this ->name = $ name ;
1415 $ this ->alias = is_object ($ alias ) ? $ alias ->name : '' ;
15- }
16-
17- public function equals (PhpType $ other ): bool {
18- if (str_replace ('[] ' , '' , $ this ->name ) !== str_replace ('[] ' , '' , $ other ->name )) {
19- return false ;
20- }
21- if ($ this ->namespace !== $ other ->namespace ) {
22- return false ;
23- }
24- return true ;
16+ $ this ->nullable = $ nullable ;
2517 }
2618
2719 public function getName (): string {
@@ -33,7 +25,7 @@ public function getMeta(): string {
3325 }
3426
3527 /**
36- * @return string[]
28+ * @return string[] namespace
3729 */
3830 public function getNamespace (): array {
3931 return $ this ->namespace ;
@@ -42,4 +34,18 @@ public function getNamespace(): array {
4234 public function getAlias (): string {
4335 return $ this ->alias ;
4436 }
37+
38+ public function getNullable (): bool {
39+ return $ this ->nullable ;
40+ }
41+
42+ public function equals (PhpType $ other ): bool {
43+ if (str_replace ('[] ' , '' , $ this ->name ) !== str_replace ('[] ' , '' , $ other ->name )) {
44+ return false ;
45+ }
46+ if ($ this ->namespace !== $ other ->namespace ) {
47+ return false ;
48+ }
49+ return true ;
50+ }
4551}
0 commit comments