class FunctionExpression
Same name in this branch
- 11.1.x vendor/mck89/peast/lib/Peast/Syntax/Node/FunctionExpression.php \Peast\Syntax\Node\FunctionExpression
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\CallExpression extends \Twig\Node\Expression\AbstractExpression
- class \Twig\Node\Expression\FunctionExpression extends \Twig\Node\Expression\CallExpression
- class \Twig\Node\Expression\CallExpression extends \Twig\Node\Expression\AbstractExpression
- class \Twig\Node\Expression\AbstractExpression extends \Twig\Node\Node
Expanded class hierarchy of FunctionExpression
10 files declare their use of FunctionExpression
- ComponentNodeVisitor.php in core/
lib/ Drupal/ Core/ Template/ ComponentNodeVisitor.php - DefinedTest.php in vendor/
twig/ twig/ src/ Node/ Expression/ Test/ DefinedTest.php - EnumCasesFunction.php in vendor/
twig/ twig/ src/ Node/ Expression/ FunctionNode/ EnumCasesFunction.php - EnumFunction.php in vendor/
twig/ twig/ src/ Node/ Expression/ FunctionNode/ EnumFunction.php - OptimizerNodeVisitor.php in vendor/
twig/ twig/ src/ NodeVisitor/ OptimizerNodeVisitor.php
3 string references to 'FunctionExpression'
- Parser::parseFunctionOrGeneratorExpression in vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Parser.php - Parses function or generator expression
- Parser::parseMethodDefinition in vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Parser.php - Parses a method definition
- Renderer::renderNode in vendor/
mck89/ peast/ lib/ Peast/ Renderer.php - Renders a node
File
-
vendor/
twig/ twig/ src/ Node/ Expression/ FunctionExpression.php, line 20
Namespace
Twig\Node\ExpressionView source
class FunctionExpression extends CallExpression {
public function __construct(TwigFunction|string $function, Node $arguments, int $lineno) {
if ($function instanceof TwigFunction) {
$name = $function->getName();
}
else {
$name = $function;
trigger_deprecation('twig/twig', '3.12', 'Not passing an instance of "TwigFunction" when creating a "%s" function of type "%s" is deprecated.', $name, static::class);
}
parent::__construct([
'arguments' => $arguments,
], [
'name' => $name,
'type' => 'function',
'is_defined_test' => false,
], $lineno);
if ($function instanceof TwigFunction) {
$this->setAttribute('twig_callable', $function);
}
$this->deprecateAttribute('needs_charset', new NameDeprecation('twig/twig', '3.12'));
$this->deprecateAttribute('needs_environment', new NameDeprecation('twig/twig', '3.12'));
$this->deprecateAttribute('needs_context', new NameDeprecation('twig/twig', '3.12'));
$this->deprecateAttribute('arguments', new NameDeprecation('twig/twig', '3.12'));
$this->deprecateAttribute('callable', new NameDeprecation('twig/twig', '3.12'));
$this->deprecateAttribute('is_variadic', new NameDeprecation('twig/twig', '3.12'));
$this->deprecateAttribute('dynamic_name', new NameDeprecation('twig/twig', '3.12'));
}
public function compile(Compiler $compiler) {
$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 "function" node in a NodeVisitor class is not supported anymore.');
$this->removeAttribute('twig_callable');
}
}
if (!$this->hasAttribute('twig_callable')) {
$this->setAttribute('twig_callable', $compiler->getEnvironment()
->getFunction($name));
}
if ('constant' === $name && $this->getAttribute('is_defined_test')) {
$this->getNode('arguments')
->setNode('checkDefined', new ConstantExpression(true, $this->getTemplateLine()));
}
$this->compileCallable($compiler);
}
}
Members
Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|---|
AbstractExpression::hasExplicitParentheses | public | function | ||||
AbstractExpression::isGenerator | public | function | ||||
AbstractExpression::setExplicitParentheses | public | function | ||||
CallExpression::$reflector | private | property | ||||
CallExpression::compileArguments | protected | function | ||||
CallExpression::compileCallable | protected | function | ||||
CallExpression::getArguments | Deprecated | protected | function | |||
CallExpression::getCallableParameters | private | function | ||||
CallExpression::getTwigCallable | private | function | Overrides the Twig callable based on attributes (as potentially, attributes changed between the creation and the compilation of the node). | |||
CallExpression::normalizeName | Deprecated | protected | function | |||
CallExpression::reflectCallable | private | function | ||||
FunctionExpression::compile | public | function | Overrides Node::compile | 2 | ||
FunctionExpression::__construct | public | function | Overrides Node::__construct | |||
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 |