Skip to content

Commit

Permalink
Fix incorrect behavior for empty return types, related to #5
Browse files Browse the repository at this point in the history
  • Loading branch information
lisachenko committed Feb 21, 2016
1 parent 872c383 commit eb05bb9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Traits/ReflectionFunctionLikeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ public function getReturnType()
$returnType = $returnType->toString();
} elseif (is_string($returnType)) {
$isBuiltin = true;
} else {
return null;
}

return new ReflectionType($returnType, false, $isBuiltin);
Expand Down
5 changes: 5 additions & 0 deletions tests/ReflectionFunctionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ public function testGetReturnTypeMethod()
$this->assertSame($originalReturnType->allowsNull(), $parsedReturnType->allowsNull());
$this->assertSame($originalReturnType->isBuiltin(), $parsedReturnType->isBuiltin());
$this->assertSame($originalReturnType->__toString(), $parsedReturnType->__toString());
} else {
$this->assertSame(
$originalRefFunction->getReturnType(),
$refFunction->getReturnType()
);
}
}
}
Expand Down

0 comments on commit eb05bb9

Please sign in to comment.