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

Breadcrumb

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

function AbstractTwigCallable::__construct

6 calls to AbstractTwigCallable::__construct()
TwigFilter::__construct in vendor/twig/twig/src/TwigFilter.php
TwigFilter::__construct in vendor/twig/twig/src/TwigFilter.php
TwigFunction::__construct in vendor/twig/twig/src/TwigFunction.php
TwigFunction::__construct in vendor/twig/twig/src/TwigFunction.php
TwigTest::__construct in vendor/twig/twig/src/TwigTest.php

... See full list

3 methods override AbstractTwigCallable::__construct()
TwigFilter::__construct in vendor/twig/twig/src/TwigFilter.php
TwigFunction::__construct in vendor/twig/twig/src/TwigFunction.php
TwigTest::__construct in vendor/twig/twig/src/TwigTest.php

File

vendor/twig/twig/src/AbstractTwigCallable.php, line 26

Class

AbstractTwigCallable
@author Fabien Potencier <fabien@symfony.com>

Namespace

Twig

Code

public function __construct(string $name, $callable = null, array $options = []) {
    $this->name = $this->dynamicName = $name;
    $this->callable = $callable;
    $this->arguments = [];
    $this->options = array_merge([
        'needs_environment' => false,
        'needs_context' => false,
        'needs_charset' => false,
        'is_variadic' => false,
        'deprecation_info' => null,
        'deprecated' => false,
        'deprecating_package' => '',
        'alternative' => null,
    ], $options);
    if ($this->options['deprecation_info'] && !$this->options['deprecation_info'] instanceof DeprecatedCallableInfo) {
        throw new \LogicException(\sprintf('The "deprecation_info" option must be an instance of "%s".', DeprecatedCallableInfo::class));
    }
    if ($this->options['deprecated']) {
        if ($this->options['deprecation_info']) {
            throw new \LogicException('When setting the "deprecation_info" option, you need to remove the obsolete deprecated options.');
        }
        trigger_deprecation('twig/twig', '3.15', 'Using the "deprecated", "deprecating_package", and "alternative" options is deprecated, pass a "deprecation_info" one instead.');
        $this->options['deprecation_info'] = new DeprecatedCallableInfo($this->options['deprecating_package'], $this->options['deprecated'], null, $this->options['alternative']);
    }
    if ($this->options['deprecation_info']) {
        $this->options['deprecation_info']
            ->setName($name);
        $this->options['deprecation_info']
            ->setType($this->getType());
    }
}

API Navigation

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