Skip to content

Commit

Permalink
Merge pull request #6 from goaop/fix/empty-reflection-type
Browse files Browse the repository at this point in the history
Fix incorrect behavior for empty parameter types, resolves #5
  • Loading branch information
lisachenko committed Feb 20, 2016
2 parents 8c98194 + dc7f053 commit 872c383
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ReflectionParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ public function getType()
$parameterType = $parameterType->toString();
} elseif (is_string($parameterType)) {
$isBuiltin = true;
} else {
return null;
}

return new ReflectionType($parameterType, $allowsNull, $isBuiltin);
Expand Down
5 changes: 5 additions & 0 deletions tests/ReflectionParameterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ public function testGetTypeMethod()
$this->assertSame($originalReturnType->allowsNull(), $parsedReturnType->allowsNull());
$this->assertSame($originalReturnType->isBuiltin(), $parsedReturnType->isBuiltin());
$this->assertSame($originalReturnType->__toString(), $parsedReturnType->__toString());
} else {
$this->assertSame(
$originalRefParameter->getType(),
$refParameter->getType()
);
}
}
}
Expand Down

0 comments on commit 872c383

Please sign in to comment.