private function parseFunctionOrClosureDeclaration()
{
$this->tokenStack->push();
$this->consumeToken(Tokens::T_FUNCTION);
$this->consumeComments();
$returnReference = $this->parseOptionalByReference();
if ($this->isNextTokenFormalParameterList()) {
$callable = $this->parseClosureDeclaration();
return $this->setNodePositionsAndReturn($callable);
} else {
$callable = $this->parseFunctionDeclaration();
$this->compilationUnit->addChild($callable);
}
$callable->setComment($this->docComment);
$callable->setTokens($this->tokenStack->pop());
$this->prepareCallable($callable);
if ($returnReference) {
$callable->setReturnsReference();
}
$this->reset();
return $callable;
}