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

Breadcrumb

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

class TwigSimpleCheckToStringNode

Defines a twig node for simplifying CheckToStringNode.

Drupal's sandbox policy is very permissive with checking whether an object can be converted to a string. We allow any object with a __toString method. This means that the array traversal in the default SandboxExtension implementation added by the parent class is a performance overhead we don't need.

Hierarchy

  • class \Twig\Node\Node implements \Twig\Node\Countable, \Twig\Node\IteratorAggregate
    • class \Twig\Node\Expression\AbstractExpression extends \Twig\Node\Node
      • class \Twig\Node\CheckToStringNode extends \Twig\Node\Expression\AbstractExpression
        • class \Drupal\Core\Template\TwigSimpleCheckToStringNode extends \Twig\Node\CheckToStringNode

Expanded class hierarchy of TwigSimpleCheckToStringNode

See also

\Drupal\Core\Template\TwigSandboxPolicy

\Drupal\Core\Template\RemoveCheckToStringNodeVisitor

File

core/lib/Drupal/Core/Template/TwigSimpleCheckToStringNode.php, line 22

Namespace

Drupal\Core\Template
View source
final class TwigSimpleCheckToStringNode extends CheckToStringNode {
    
    /**
     * {@inheritdoc}
     */
    public function compile(Compiler $compiler) : void {
        $expr = $this->getNode('expr');
        $compiler->subcompile($expr);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AbstractExpression::hasExplicitParentheses public function
AbstractExpression::isGenerator public function
AbstractExpression::setExplicitParentheses public function
CheckToStringNode::__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
TwigSimpleCheckToStringNode::compile public function Overrides CheckToStringNode::compile

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal