1<?php 2 3/* 4 * This file is part of Twig. 5 * 6 * (c) Fabien Potencier 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12namespace Twig\Extension; 13 14use Twig\NodeVisitor\NodeVisitorInterface; 15use Twig\TokenParser\TokenParserInterface; 16use Twig\TwigFilter; 17use Twig\TwigFunction; 18use Twig\TwigTest; 19 20/** 21 * Interface implemented by extension classes. 22 * 23 * @author Fabien Potencier <fabien@symfony.com> 24 */ 25interface ExtensionInterface 26{ 27 /** 28 * Returns the token parser instances to add to the existing list. 29 * 30 * @return TokenParserInterface[] 31 */ 32 public function getTokenParsers(); 33 34 /** 35 * Returns the node visitor instances to add to the existing list. 36 * 37 * @return NodeVisitorInterface[] 38 */ 39 public function getNodeVisitors(); 40 41 /** 42 * Returns a list of filters to add to the existing list. 43 * 44 * @return TwigFilter[] 45 */ 46 public function getFilters(); 47 48 /** 49 * Returns a list of tests to add to the existing list. 50 * 51 * @return TwigTest[] 52 */ 53 public function getTests(); 54 55 /** 56 * Returns a list of functions to add to the existing list. 57 * 58 * @return TwigFunction[] 59 */ 60 public function getFunctions(); 61 62 /** 63 * Returns a list of operators to add to the existing list. 64 * 65 * @return array<array> First array of unary operators, second array of binary operators 66 */ 67 public function getOperators(); 68} 69 70class_alias('Twig\Extension\ExtensionInterface', 'Twig_ExtensionInterface'); 71 72// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. 73class_exists('Twig\Environment'); 74