This repository was archived by the owner on Jan 29, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,9 @@ public static function fromArray(array $array)
165
165
case 'visibility ' :
166
166
$ method ->setVisibility ($ value );
167
167
break ;
168
+ case 'returntype ' :
169
+ $ method ->setReturnType ($ value );
170
+ break ;
168
171
}
169
172
}
170
173
@@ -283,6 +286,14 @@ public function setReturnType($returnType = null)
283
286
return $ this ;
284
287
}
285
288
289
+ /**
290
+ * @return TypeGenerator|null
291
+ */
292
+ public function getReturnType ()
293
+ {
294
+ return $ this ->returnType ;
295
+ }
296
+
286
297
/**
287
298
* @param bool $returnsReference
288
299
*
Original file line number Diff line number Diff line change @@ -237,6 +237,7 @@ public function testCreateFromArray()
237
237
'final ' => true ,
238
238
'static ' => true ,
239
239
'visibility ' => MethodGenerator::VISIBILITY_PROTECTED ,
240
+ 'returntype ' => '\\SampleType ' ,
240
241
]);
241
242
242
243
$ this ->assertEquals ('SampleMethod ' , $ methodGenerator ->getName ());
@@ -246,6 +247,8 @@ public function testCreateFromArray()
246
247
$ this ->assertTrue ($ methodGenerator ->isFinal ());
247
248
$ this ->assertTrue ($ methodGenerator ->isStatic ());
248
249
$ this ->assertEquals (MethodGenerator::VISIBILITY_PROTECTED , $ methodGenerator ->getVisibility ());
250
+ $ this ->assertInstanceOf ('Zend\Code\Generator\TypeGenerator ' , $ methodGenerator ->getReturnType ());
251
+ $ this ->assertEquals ('\\SampleType ' , $ methodGenerator ->getReturnType ()->generate ());
249
252
}
250
253
251
254
public function testCreateInterfaceMethodFromArray ()
You can’t perform that action at this time.
0 commit comments