Skip to content

Commit

Permalink
Fix fatal error for empty yields
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Jul 16, 2014
1 parent 04cbfea commit 7ab0736
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php
Expand Up @@ -6583,12 +6583,15 @@ private function parseYield()

$yield = $this->builder->buildAstYieldStatement($token->image);

$yield->addChild($this->parseOptionalExpression());
$node = $this->parseOptionalExpression();
if ($node) {
$yield->addChild($node);

if ($this->tokenizer->peek() === Tokens::T_DOUBLE_ARROW) {
$this->consumeToken(Tokens::T_DOUBLE_ARROW);
if ($this->tokenizer->peek() === Tokens::T_DOUBLE_ARROW) {
$this->consumeToken(Tokens::T_DOUBLE_ARROW);

$yield->addChild($this->parseOptionalExpression());
$yield->addChild($this->parseOptionalExpression());
}
}

$this->consumeComments();
Expand Down

0 comments on commit 7ab0736

Please sign in to comment.