class AssignNameExpression
Hierarchy
- class \Twig\Node\Node implements \Twig\Node\Countable, \Twig\Node\IteratorAggregate
- class \Twig\Node\Expression\AbstractExpression extends \Twig\Node\Node
- class \Twig\Node\Expression\NameExpression extends \Twig\Node\Expression\AbstractExpression
- class \Twig\Node\Expression\AssignNameExpression extends \Twig\Node\Expression\NameExpression
- class \Twig\Node\Expression\NameExpression extends \Twig\Node\Expression\AbstractExpression
- class \Twig\Node\Expression\AbstractExpression extends \Twig\Node\Node
Expanded class hierarchy of AssignNameExpression
3 files declare their use of AssignNameExpression
- AssignContextVariable.php in vendor/
twig/ twig/ src/ Node/ Expression/ Variable/ AssignContextVariable.php - ForNode.php in vendor/
twig/ twig/ src/ Node/ ForNode.php - TwigNodeVisitorCheckDeprecations.php in core/
lib/ Drupal/ Core/ Template/ TwigNodeVisitorCheckDeprecations.php
File
-
vendor/
twig/ twig/ src/ Node/ Expression/ AssignNameExpression.php, line 19
Namespace
Twig\Node\ExpressionView source
class AssignNameExpression extends NameExpression {
public function __construct(string $name, int $lineno) {
if (self::class === static::class) {
trigger_deprecation('twig/twig', '3.15', 'The "%s" class is deprecated, use "%s" instead.', self::class, AssignContextVariable::class);
}
// All names supported by ExpressionParser::parsePrimaryExpression() should be excluded
if (\in_array(strtolower($name), [
'true',
'false',
'none',
'null',
])) {
throw new SyntaxError(\sprintf('You cannot assign a value to "%s".', $name), $lineno);
}
parent::__construct($name, $lineno);
}
public function compile(Compiler $compiler) : void {
$compiler->raw('$context[')
->string($this->getAttribute('name'))
->raw(']');
}
}