4 * This file is part of Twig.
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
13 * Checks if a variable is the exact same value as a constant.
16 * {% if post.status is constant('Post::PUBLISHED') %}
17 * the status attribute is exactly the same as Post::PUBLISHED
21 * @author Fabien Potencier <fabien@symfony.com>
23 class Twig_Node_Expression_Test_Constant extends Twig_Node_Expression_Test
25 public function compile(Twig_Compiler $compiler)
29 ->subcompile($this->getNode('node'))
30 ->raw(' === constant(')
33 if ($this->getNode('arguments')->hasNode(1)) {
36 ->subcompile($this->getNode('arguments')->getNode(1))
42 ->subcompile($this->getNode('arguments')->getNode(0))
48 class_alias('Twig_Node_Expression_Test_Constant', 'Twig\Node\Expression\Test\ConstantTest', false);