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 10
10
namespace Nette \PhpGenerator ;
11
11
12
12
use Nette ;
13
+ use Nette \Utils \Type ;
13
14
14
15
15
16
/**
@@ -61,9 +62,14 @@ public function setType(?string $type): self
61
62
}
62
63
63
64
64
- public function getType (): ?string
65
+ /**
66
+ * @return Type|string|null
67
+ */
68
+ public function getType (bool $ asObject = false )
65
69
{
66
- return $ this ->type ;
70
+ return $ asObject && $ this ->type
71
+ ? Type::fromString ($ this ->type )
72
+ : $ this ->type ;
67
73
}
68
74
69
75
Original file line number Diff line number Diff line change 10
10
namespace Nette \PhpGenerator ;
11
11
12
12
use Nette ;
13
+ use Nette \Utils \Type ;
13
14
14
15
15
16
/**
@@ -81,9 +82,14 @@ public function setType(?string $type): self
81
82
}
82
83
83
84
84
- public function getType (): ?string
85
+ /**
86
+ * @return Type|string|null
87
+ */
88
+ public function getType (bool $ asObject = false )
85
89
{
86
- return $ this ->type ;
90
+ return $ asObject && $ this ->type
91
+ ? Type::fromString ($ this ->type )
92
+ : $ this ->type ;
87
93
}
88
94
89
95
Original file line number Diff line number Diff line change 12
12
use Nette ;
13
13
use Nette \PhpGenerator \Dumper ;
14
14
use Nette \PhpGenerator \Parameter ;
15
+ use Nette \Utils \Type ;
15
16
16
17
17
18
/**
@@ -130,9 +131,14 @@ public function setReturnType(?string $type): self
130
131
}
131
132
132
133
133
- public function getReturnType (): ?string
134
+ /**
135
+ * @return Type|string|null
136
+ */
137
+ public function getReturnType (bool $ asObject = false )
134
138
{
135
- return $ this ->returnType ;
139
+ return $ asObject && $ this ->returnType
140
+ ? Type::fromString ($ this ->returnType )
141
+ : $ this ->returnType ;
136
142
}
137
143
138
144
You can’t perform that action at this time.
0 commit comments