Skip to content

Commit 895c55f

Browse files
zuozp8DavertMik
authored andcommitted
#123 return void (#130)
1 parent 39140a1 commit 895c55f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/AspectMock/Intercept/BeforeMockTransformer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ public function transform(StreamMetaData $metadata)
5353
if (preg_match('/(\@return\s+[\\\]?Generator)/', $method->getDocComment())) {
5454
$beforeDefinition = str_replace('return', 'yield', $beforeDefinition);
5555
}
56+
if (method_exists($method, 'getReturnType') && $method->getReturnType() == 'void') {
57+
//TODO remove method_exists($method, 'getReturnType') when support for php5 is dropped
58+
$beforeDefinition = str_replace('return $__am_res;', 'return;', $beforeDefinition);
59+
}
60+
5661
$reflectedParams = $method->getParameters();
5762

5863
$params = [];

0 commit comments

Comments
 (0)