Skip to content

Commit

Permalink
Merge pull request #7 from goaop/fix/empty-return-type
Browse files Browse the repository at this point in the history
Fix incorrect behavior for empty return types
  • Loading branch information
lisachenko committed Feb 21, 2016
2 parents 872c383 + eb05bb9 commit d8f51e0
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 d8f51e0

Please sign in to comment.