default to null to not fail if type is not annotated via phpdoc

This commit is contained in:
Bernhard Posselt 2014-05-07 20:07:52 +02:00
parent 1d45239c65
commit fcb1aa36f0
1 changed files with 7 additions and 3 deletions

View File

@ -68,11 +68,15 @@ class ControllerMethodReflector {
* Inspects the PHPDoc parameters for types * Inspects the PHPDoc parameters for types
* @param strint $parameter the parameter whose type comments should be * @param strint $parameter the parameter whose type comments should be
* parsed * parsed
* @return string type in the type parameters (@param int $something) would * @return string|null type in the type parameters (@param int $something)
* return int * would return int or null if not existing
*/ */
public function getType($parameter) { public function getType($parameter) {
return $this->types[$parameter]; if(array_key_exists($parameter, $this->types)) {
return $this->types[$parameter];
} else {
return null;
}
} }