Null.php 618 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) 2011 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. /**
  11. * Checks that a variable is null.
  12. *
  13. * <pre>
  14. * {{ var is none }}
  15. * </pre>
  16. *
  17. * @author Fabien Potencier <fabien@symfony.com>
  18. */
  19. class Twig_Node_Expression_Test_Null extends Twig_Node_Expression_Test
  20. {
  21. public function compile(Twig_Compiler $compiler)
  22. {
  23. $compiler
  24. ->raw('(null === ')
  25. ->subcompile($this->getNode('node'))
  26. ->raw(')')
  27. ;
  28. }
  29. }