PDepend\Source\Language\PHP\AbstractPHPParser::parseParentReference PHP Method

parseParentReference() private method

This method parses a {@link \PDepend\Source\AST\ASTParentReference} node.
Since: 0.9.6
private parseParentReference ( PDepend\Source\Tokenizer\Token $token ) : PDepend\Source\AST\ASTNode
$token PDepend\Source\Tokenizer\Token The "self" keyword token.
return PDepend\Source\AST\ASTNode
    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;
    }
AbstractPHPParser