lib/Twig/lib/Twig/NodeVisitor/Optimizer.php
protected function optimizePrintNode(Twig_NodeInterface $node, Twig_Environment $env)
    {
        if (!$node instanceof Twig_Node_Print) {
            return $node;
        }

        $exprNode = $node->getNode('expr');
        if (
            $exprNode instanceof Twig_Node_Expression_BlockReference ||
            $exprNode instanceof Twig_Node_Expression_Parent
        ) {
            $exprNode->setAttribute('output', true);

            return $exprNode;
        }

        return $node;
    }
protected function optimizePrintNode(Twig_NodeInterface $node, Twig_Environment $env)
    {
        if (!$node instanceof Twig_Node_Print) {
            return $node;
        }

        $exprNode = $node->getNode('expr');
        if (
            $exprNode instanceof Twig_Node_Expression_BlockReference ||
            $exprNode instanceof Twig_Node_Expression_Parent
        ) {
            $exprNode->setAttribute('output', true);

            return $exprNode;
        }

        return $node;
    }
Optimizes print nodes.

It replaces:

* "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()"

@return Twig_NodeInterface