Sstalle\php7cc\NodeVisitor\YieldInExpressionContextVisitor::enterNode PHP Method

enterNode() public method

public enterNode ( PhpParser\Node $node )
$node PhpParser\Node
    public function enterNode(Node $node)
    {
        if ($node instanceof Node\Expr\Yield_) {
            $startTokenPosition = $node->getAttribute('startTokenPos');
            $endTokenPosition = $node->getAttribute('endTokenPos');
            if (!($this->tokenCollection->isTokenPrecededBy($startTokenPosition, '(') && $this->tokenCollection->isTokenFollowedBy($endTokenPosition, ')')) && !$this->expressionStack->isEmpty()) {
                $this->addContextMessage('"yield" usage in expression context', $this->expressionStack->top());
            }
        } elseif ($node instanceof Node\Expr) {
            $this->expressionStack->push($node);
        }
    }
YieldInExpressionContextVisitor