function TestExpression::compile
Overrides Node::compile
7 methods override TestExpression::compile()
- ConstantTest::compile in vendor/
twig/ twig/ src/ Node/ Expression/ Test/ ConstantTest.php - DefinedTest::compile in vendor/
twig/ twig/ src/ Node/ Expression/ Test/ DefinedTest.php - DivisiblebyTest::compile in vendor/
twig/ twig/ src/ Node/ Expression/ Test/ DivisiblebyTest.php - EvenTest::compile in vendor/
twig/ twig/ src/ Node/ Expression/ Test/ EvenTest.php - NullTest::compile in vendor/
twig/ twig/ src/ Node/ Expression/ Test/ NullTest.php
File
-
vendor/
twig/ twig/ src/ Node/ Expression/ TestExpression.php, line 56
Class
Namespace
Twig\Node\ExpressionCode
public function compile(Compiler $compiler) : void {
$name = $this->getAttribute('name');
if ($this->hasAttribute('twig_callable')) {
$name = $this->getAttribute('twig_callable')
->getName();
if ($name !== $this->getAttribute('name')) {
trigger_deprecation('twig/twig', '3.12', 'Changing the value of a "test" node in a NodeVisitor class is not supported anymore.');
$this->removeAttribute('twig_callable');
}
}
if (!$this->hasAttribute('twig_callable')) {
$this->setAttribute('twig_callable', $compiler->getEnvironment()
->getTest($this->getAttribute('name')));
}
$this->compileCallable($compiler);
}