File tree Expand file tree Collapse file tree 3 files changed +24
-6
lines changed
Expand file tree Collapse file tree 3 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 1010namespace Nette \PhpGenerator ;
1111
1212use Nette ;
13+ use Nette \Utils \Type ;
1314
1415
1516/**
@@ -61,9 +62,14 @@ public function setType(?string $type): self
6162 }
6263
6364
64- public function getType (): ?string
65+ /**
66+ * @return Type|string|null
67+ */
68+ public function getType (bool $ asObject = false )
6569 {
66- return $ this ->type ;
70+ return $ asObject && $ this ->type
71+ ? Type::fromString ($ this ->type )
72+ : $ this ->type ;
6773 }
6874
6975
Original file line number Diff line number Diff line change 1010namespace Nette \PhpGenerator ;
1111
1212use Nette ;
13+ use Nette \Utils \Type ;
1314
1415
1516/**
@@ -81,9 +82,14 @@ public function setType(?string $type): self
8182 }
8283
8384
84- public function getType (): ?string
85+ /**
86+ * @return Type|string|null
87+ */
88+ public function getType (bool $ asObject = false )
8589 {
86- return $ this ->type ;
90+ return $ asObject && $ this ->type
91+ ? Type::fromString ($ this ->type )
92+ : $ this ->type ;
8793 }
8894
8995
Original file line number Diff line number Diff line change 1212use Nette ;
1313use Nette \PhpGenerator \Dumper ;
1414use Nette \PhpGenerator \Parameter ;
15+ use Nette \Utils \Type ;
1516
1617
1718/**
@@ -130,9 +131,14 @@ public function setReturnType(?string $type): self
130131 }
131132
132133
133- public function getReturnType (): ?string
134+ /**
135+ * @return Type|string|null
136+ */
137+ public function getReturnType (bool $ asObject = false )
134138 {
135- return $ this ->returnType ;
139+ return $ asObject && $ this ->returnType
140+ ? Type::fromString ($ this ->returnType )
141+ : $ this ->returnType ;
136142 }
137143
138144
You can’t perform that action at this time.
0 commit comments