NullCoalesce.php 808 B

123456789101112131415161718192021222324
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) Fabien Potencier
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. class Twig_Node_Expression_NullCoalesce extends Twig_Node_Expression_Conditional
  11. {
  12. public function __construct(Twig_NodeInterface $left, Twig_NodeInterface $right, $lineno)
  13. {
  14. $test = new Twig_Node_Expression_Binary_And(
  15. new Twig_Node_Expression_Test_Defined(clone $left, 'defined', new Twig_Node(), $left->getLine()),
  16. new Twig_Node_Expression_Unary_Not(new Twig_Node_Expression_Test_Null($left, 'null', new Twig_Node(), $left->getLine()), $left->getLine()),
  17. $left->getLine()
  18. );
  19. parent::__construct($test, $left, $right, $lineno);
  20. }
  21. }