PhpParser\PrettyPrinter\Standard::pExpr_Yield PHP Method

pExpr_Yield() protected method

protected pExpr_Yield ( PhpParser\Node\Expr\Yield_ $node )
$node PhpParser\Node\Expr\Yield_
    protected function pExpr_Yield(Expr\Yield_ $node) {
        if ($node->value === null) {
            return 'yield';
        } else {
            // this is a bit ugly, but currently there is no way to detect whether the parentheses are necessary
            return '(yield '
                 . ($node->key !== null ? $this->p($node->key) . ' => ' : '')
                 . $this->p($node->value)
                 . ')';
        }
    }
Standard