Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TestExpression.php

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

... See full list

File

vendor/twig/twig/src/Node/Expression/TestExpression.php, line 56

Class

TestExpression

Namespace

Twig\Node\Expression

Code

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);
}
RSS feed
Powered by Drupal