private function GetTypeHint($className, $propertyName)
{
$typeHint = null;
$clazz = new ReflectionClass($className);
// Use reflection to get a property of the class whose name is the
// same as the property's tag name.
// Then extract the type hint from the annotation of the property.
if ($clazz->hasProperty($propertyName)) {
$prop = $clazz->getProperty($propertyName);
if (preg_match('/@var\\s*(.+)\\s/', $prop->getDocComment(), $annotations)) {
// The type hints are sometimes prefixed with "tns", which is stripped
// here to extract only the type names.
$typeHint = preg_replace('/^tns/', '', $annotations[1]);
}
}
return $typeHint;
}