class TwigNodeCheckDeprecations
A node that checks deprecated variable usage.
Hierarchy
- class \Twig\Node\Node implements \Twig\Node\Countable, \Twig\Node\IteratorAggregate
- class \Drupal\Core\Template\TwigNodeCheckDeprecations extends \Twig\Node\Node
Expanded class hierarchy of TwigNodeCheckDeprecations
See also
\Drupal\Core\Template\TwigNodeVisitorCheckDeprecations
\Drupal\Core\Template\TwigExtension::checkDeprecations()
File
-
core/
lib/ Drupal/ Core/ Template/ TwigNodeCheckDeprecations.php, line 16
Namespace
Drupal\Core\TemplateView source
class TwigNodeCheckDeprecations extends Node {
/**
* The named variables used in the template.
*/
protected array $usedNames = [];
/**
* {@inheritdoc}
*/
public function __construct(array $usedNames) {
$this->usedNames = $usedNames;
parent::__construct();
}
/**
* {@inheritdoc}
*/
public function compile(Compiler $compiler) {
$usedNamesNode = new ArrayExpression([], $this->getTemplateLine());
foreach ($this->usedNames as $name) {
$usedNamesNode->addElement(new ConstantExpression($name, $this->getTemplateLine()));
}
$compiler->write("\$this->env->getExtension('\\Drupal\\Core\\Template\\TwigExtension')\n");
$compiler->indent();
$compiler->write("->checkDeprecations(\$context, ");
$compiler->subcompile($usedNamesNode);
$compiler->raw(");");
$compiler->outdent();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
Node::$attributeNameDeprecations | private | property | @var array<string, NameDeprecation> | ||
Node::$attributes | protected | property | |||
Node::$lineno | protected | property | |||
Node::$nodeNameDeprecations | private | property | @var array<string, NameDeprecation> | ||
Node::$nodes | protected | property | |||
Node::$sourceContext | private | property | |||
Node::$tag | protected | property | |||
Node::count | public | function | |||
Node::deprecateAttribute | public | function | |||
Node::deprecateNode | public | function | |||
Node::getAttribute | public | function | |||
Node::getIterator | public | function | |||
Node::getNode | public | function | |||
Node::getNodeTag | public | function | |||
Node::getSourceContext | public | function | |||
Node::getTemplateLine | public | function | |||
Node::getTemplateName | public | function | |||
Node::hasAttribute | public | function | |||
Node::hasNode | public | function | |||
Node::removeAttribute | public | function | |||
Node::removeNode | public | function | |||
Node::setAttribute | public | function | |||
Node::setNode | public | function | 1 | ||
Node::setNodeTag | public | function | @internal | ||
Node::setSourceContext | public | function | |||
Node::__toString | public | function | |||
TwigNodeCheckDeprecations::$usedNames | protected | property | The named variables used in the template. | ||
TwigNodeCheckDeprecations::compile | public | function | Overrides Node::compile | ||
TwigNodeCheckDeprecations::__construct | public | function | Overrides Node::__construct |