private function parseParentReference(Token $token)
{
if ($this->classOrInterface === null) {
throw new InvalidStateException($token->startLine, (string) $this->compilationUnit, 'The keyword "parent" was used as type hint but the parameter ' . 'declaration is not in a class scope.');
}
if ($this->classOrInterface instanceof ASTTrait) {
$classReference = $this->builder->buildAstClassReference('__PDepend_TraitRuntimeReference');
} else {
$classReference = $this->classOrInterface->getParentClassReference();
}
if ($classReference === null) {
throw new InvalidStateException($token->startLine, (string) $this->compilationUnit, sprintf('The keyword "parent" was used as type hint but the ' . 'class "%s" does not declare a parent.', $this->classOrInterface->getName()));
}
$ref = $this->builder->buildAstParentReference($classReference);
$ref->configureLinesAndColumns($token->startLine, $token->endLine, $token->startColumn, $token->endColumn);
return $ref;
}