/** * This method parses a method declaration. * * @return \PDepend\Source\AST\ASTMethod * @since 0.9.5 */ private function parseMethodDeclaration() { // Read function keyword $this->consumeToken(Tokens::T_FUNCTION); $this->consumeComments(); $returnsReference = $this->parseOptionalByReference(); $methodName = $this->parseFunctionName(); $method = $this->builder->buildMethod($methodName); $method->setDocComment($this->docComment); $method->setCompilationUnit($this->compilationUnit); $this->classOrInterface->addMethod($method); $this->parseCallableDeclaration($method); $this->prepareCallable($method); if ($returnsReference === true) { $method->setReturnsReference(); } return $method; }