private function extractTypehints(&$tokens, $index, $token)
{
$typehint = '';
for ($i = $index - 1; in_array($tokens[$i][0], $this->typehintTokens); $i--) {
$typehint = $tokens[$i][1] . $typehint;
if (T_WHITESPACE !== $tokens[$i][0]) {
unset($tokens[$i]);
}
}
if ($typehint = trim($typehint)) {
$class = $this->namespaceResolver->resolve($this->currentClass);
try {
$typehintFcqn = $this->namespaceResolver->resolve($typehint);
$this->typeHintIndex->add($class, trim($this->currentFunction), $token[1], $typehintFcqn);
} catch (DisallowedNonObjectTypehintException $e) {
$this->typeHintIndex->addInvalid($class, trim($this->currentFunction), $token[1], $e);
}
}
}