private function parseStatementNode(Node\Stmt $node)
{
switch (true) {
case $node instanceof Node\Stmt\Return_:
return Expression::returnExpression($node->expr !== null ? $this->parseNode($node->expr) : null);
case $node instanceof Node\Stmt\Throw_:
return Expression::throwExpression($this->parseNode($node->expr));
case $node instanceof Node\Stmt\Unset_:
return Expression::unsetExpression($this->parseNodes($node->vars));
default:
$this->verifyNotControlStructure($node);
throw new ASTException('Cannot parse AST with unknown statement node: %s', get_class($node));
}
}