diff --git a/phpBB/config/default/container/services_twig.yml b/phpBB/config/default/container/services_twig.yml index 24ee24484b..747d2ee155 100644 --- a/phpBB/config/default/container/services_twig.yml +++ b/phpBB/config/default/container/services_twig.yml @@ -67,7 +67,7 @@ services: - { name: twig.extension } template.twig.extensions.debug: - class: Twig_Extension_Debug + class: Twig\Extension\DebugExtension template: class: phpbb\template\twig\twig diff --git a/phpBB/phpbb/feed/controller/feed.php b/phpBB/phpbb/feed/controller/feed.php index 7826d19042..ff18cc0b39 100644 --- a/phpBB/phpbb/feed/controller/feed.php +++ b/phpBB/phpbb/feed/controller/feed.php @@ -16,7 +16,7 @@ namespace phpbb\feed\controller; use phpbb\auth\auth; use phpbb\config\config; use phpbb\db\driver\driver_interface; -use \phpbb\event\dispatcher_interface; +use phpbb\event\dispatcher_interface; use phpbb\exception\http_exception; use phpbb\feed\feed_interface; use phpbb\feed\exception\feed_unavailable_exception; @@ -28,11 +28,12 @@ use phpbb\user; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Twig\Environment; class feed { /** - * @var \Twig_Environment + * @var Environment */ protected $template; @@ -89,7 +90,7 @@ class feed /** * Constructor * - * @param \Twig_Environment $twig + * @param Environment $twig * @param symfony_request $request * @param controller_helper $controller_helper * @param config $config @@ -101,7 +102,7 @@ class feed * @param dispatcher_interface $phpbb_dispatcher * @param string $php_ext */ - public function __construct(\Twig_Environment $twig, symfony_request $request, controller_helper $controller_helper, config $config, driver_interface $db, ContainerInterface $container, feed_helper $feed_helper, user $user, auth $auth, dispatcher_interface $phpbb_dispatcher, $php_ext) + public function __construct(Environment $twig, symfony_request $request, controller_helper $controller_helper, config $config, driver_interface $db, ContainerInterface $container, feed_helper $feed_helper, user $user, auth $auth, dispatcher_interface $phpbb_dispatcher, $php_ext) { $this->request = $request; $this->controller_helper = $controller_helper; diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index ac4b16e457..27426606aa 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -15,7 +15,7 @@ namespace phpbb\template\twig; use phpbb\template\assets_bag; -class environment extends \Twig_Environment +class environment extends \Twig\Environment { /** @var \phpbb\config\config */ protected $phpbb_config; @@ -55,11 +55,11 @@ class environment extends \Twig_Environment * @param \phpbb\path_helper $path_helper phpBB path helper * @param string $cache_path The path to the cache directory * @param \phpbb\extension\manager $extension_manager phpBB extension manager - * @param \Twig_LoaderInterface $loader Twig loader interface + * @param \Twig\Loader\LoaderInterface $loader Twig loader interface * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object * @param array $options Array of options to pass to Twig */ - public function __construct(\phpbb\config\config $phpbb_config, \phpbb\filesystem\filesystem $filesystem, \phpbb\path_helper $path_helper, $cache_path, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, \phpbb\event\dispatcher_interface $phpbb_dispatcher = null, $options = array()) + public function __construct(\phpbb\config\config $phpbb_config, \phpbb\filesystem\filesystem $filesystem, \phpbb\path_helper $path_helper, $cache_path, \phpbb\extension\manager $extension_manager = null, \Twig\Loader\LoaderInterface $loader = null, \phpbb\event\dispatcher_interface $phpbb_dispatcher = null, $options = array()) { $this->phpbb_config = $phpbb_config; @@ -169,7 +169,7 @@ class environment extends \Twig_Environment * Set the namespace look up order to load templates from * * @param array $namespace - * @return \Twig_Environment + * @return \Twig\Environment */ public function setNamespaceLookUpOrder($namespace) { @@ -261,8 +261,8 @@ class environment extends \Twig_Environment * * @param string $name The template name * @param integer $index The index if it is an embedded template - * @return \Twig_TemplateInterface A template instance representing the given template name - * @throws \Twig_Error_Loader + * @return \Twig\Template A template instance representing the given template name + * @throws \Twig\Error\LoaderError */ public function loadTemplate($name, $index = null) { @@ -279,7 +279,7 @@ class environment extends \Twig_Environment return parent::loadTemplate('@' . $namespace . '/' . $name, $index); } - catch (\Twig_Error_Loader $e) + catch (\Twig\Error\LoaderError $e) { } } @@ -298,7 +298,7 @@ class environment extends \Twig_Environment * * @param string $name The template name * @return string - * @throws \Twig_Error_Loader + * @throws \Twig\Error\LoaderError */ public function findTemplate($name) { @@ -315,7 +315,7 @@ class environment extends \Twig_Environment return parent::getLoader()->getCacheKey('@' . $namespace . '/' . $name); } - catch (\Twig_Error_Loader $e) + catch (\Twig\Error\LoaderError $e) { } } diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index 1131a7f3aa..3dc5e548e5 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig; -class extension extends \Twig_Extension +class extension extends \Twig\Extension\AbstractExtension { /** @var \phpbb\template\context */ protected $context; @@ -51,7 +51,7 @@ class extension extends \Twig_Extension /** * Returns the token parser instance to add to the existing list. * - * @return array An array of Twig_TokenParser instances + * @return array An array of \Twig\TokenParser\AbstractTokenParser instances */ public function getTokenParsers() { @@ -74,9 +74,9 @@ class extension extends \Twig_Extension public function getFilters() { return array( - new \Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)), + new \Twig\TwigFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)), // @deprecated 3.2.0 Uses twig's JS escape method instead of addslashes - new \Twig_SimpleFilter('addslashes', 'addslashes'), + new \Twig\TwigFilter('addslashes', 'addslashes'), ); } @@ -88,9 +88,9 @@ class extension extends \Twig_Extension public function getFunctions() { return array( - new \Twig_SimpleFunction('lang', array($this, 'lang')), - new \Twig_SimpleFunction('lang_defined', array($this, 'lang_defined')), - new \Twig_SimpleFunction('get_class', 'get_class'), + new \Twig\TwigFunction('lang', array($this, 'lang')), + new \Twig\TwigFunction('lang_defined', array($this, 'lang_defined')), + new \Twig\TwigFunction('get_class', 'get_class'), ); } @@ -103,30 +103,30 @@ class extension extends \Twig_Extension { return array( array( - '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), + '!' => array('precedence' => 50, 'class' => '\Twig\Node\Expression\Unary\NotUnary'), ), array( // precedence settings are copied from similar operators in Twig core extension - '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + '||' => array('precedence' => 10, 'class' => '\Twig\Node\Expression\Binary\OrBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + '&&' => array('precedence' => 15, 'class' => '\Twig\Node\Expression\Binary\AndBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), - 'eq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'eq' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\EqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), - 'ne' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'neq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - '<>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'ne' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\NotEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + 'neq' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\NotEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + '<>' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\NotEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), - '===' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\equalequal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - '!==' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\notequalequal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + '===' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\equalequal', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + '!==' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\notequalequal', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), - 'gt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'gte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'ge' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'lt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'lte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'le' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'gt' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\GreaterBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + 'gte' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\GreaterEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + 'ge' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\GreaterEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + 'lt' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\LessBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + 'lte' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\LessEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + 'le' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\LessEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), - 'mod' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'mod' => array('precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\ModBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), ), ); } @@ -134,7 +134,7 @@ class extension extends \Twig_Extension /** * Grabs a subset of a loop * - * @param \Twig_Environment $env A Twig_Environment instance + * @param \Twig\Environment $env A Twig\Environment instance * @param mixed $item A variable * @param integer $start Start of the subset * @param integer $end End of the subset @@ -142,7 +142,7 @@ class extension extends \Twig_Extension * * @return mixed The sliced variable */ - public function loop_subset(\Twig_Environment $env, $item, $start, $end = null, $preserveKeys = false) + public function loop_subset(\Twig\Environment $env, $item, $start, $end = null, $preserveKeys = false) { // We do almost the same thing as Twig's slice (array_slice), except when $end is positive if ($end >= 1) diff --git a/phpBB/phpbb/template/twig/extension/avatar.php b/phpBB/phpbb/template/twig/extension/avatar.php index 7a17fd4b42..c699fcf5b3 100644 --- a/phpBB/phpbb/template/twig/extension/avatar.php +++ b/phpBB/phpbb/template/twig/extension/avatar.php @@ -33,7 +33,7 @@ class avatar extends \Twig_Extension public function getFunctions() { return array( - new \Twig_SimpleFunction('avatar', array($this, 'get_avatar')), + new \Twig\TwigFunction('avatar', array($this, 'get_avatar')), ); } diff --git a/phpBB/phpbb/template/twig/extension/config.php b/phpBB/phpbb/template/twig/extension/config.php index cbf6e505c5..a752890fe6 100644 --- a/phpBB/phpbb/template/twig/extension/config.php +++ b/phpBB/phpbb/template/twig/extension/config.php @@ -46,7 +46,7 @@ class config extends \Twig_Extension public function getFunctions() { return array( - new \Twig_SimpleFunction('config', array($this, 'get_config')), + new \Twig\TwigFunction('config', array($this, 'get_config')), ); } diff --git a/phpBB/phpbb/template/twig/extension/username.php b/phpBB/phpbb/template/twig/extension/username.php index ef149693a0..f419c6ff0f 100644 --- a/phpBB/phpbb/template/twig/extension/username.php +++ b/phpBB/phpbb/template/twig/extension/username.php @@ -33,7 +33,7 @@ class username extends \Twig_Extension public function getFunctions() { return array( - new \Twig_SimpleFunction('username', array($this, 'get_username')), + new \Twig\TwigFunction('username', array($this, 'get_username')), ); } diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 10346ac299..a8424f6f73 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -13,9 +13,9 @@ namespace phpbb\template\twig; -class lexer extends \Twig_Lexer +class lexer extends \Twig\Lexer { - public function tokenize(\Twig_Source $source) + public function tokenize(\Twig\Source $source) { $code = $source->getCode(); $filename = $source->getName(); @@ -125,8 +125,8 @@ class lexer extends \Twig_Lexer // Appends any filters $code = preg_replace('#{([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ $1$2 }}', $code); - // Tokenize \Twig_Source instance - return parent::tokenize(new \Twig_Source($code, $filename)); + // Tokenize \Twig\Source instance + return parent::tokenize(new \Twig\Source($code, $filename)); } /** diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php index cddcf33146..1e0b2d1520 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -18,7 +18,7 @@ use phpbb\filesystem\helper as filesystem_helper; /** * Twig Template loader */ -class loader extends \Twig_Loader_Filesystem +class loader extends \Twig\Loader\FilesystemLoader { protected $safe_directories = array(); @@ -36,7 +36,7 @@ class loader extends \Twig_Loader_Filesystem * Set safe directories * * @param array $directories Array of directories that are safe (empty to clear) - * @return \Twig_Loader_Filesystem + * @return \Twig\Loader\FilesystemLoader */ public function setSafeDirectories($directories = array()) { @@ -57,7 +57,7 @@ class loader extends \Twig_Loader_Filesystem * Add safe directory * * @param string $directory Directory that should be added - * @return \Twig_Loader_Filesystem + * @return \Twig\Loader\FilesystemLoader */ public function addSafeDirectory($directory) { @@ -105,11 +105,11 @@ class loader extends \Twig_Loader_Filesystem } /** - * Find the template - * - * Override for Twig_Loader_Filesystem::findTemplate to add support - * for loading from safe directories. - */ + * Find the template + * + * Override for \Twig\Loader\FilesystemLoader::findTemplate + * to add support for loading from safe directories. + */ protected function findTemplate($name, $throw = true) { $name = (string) $name; @@ -133,7 +133,7 @@ class loader extends \Twig_Loader_Filesystem // Try validating the name (which may throw an exception) $this->validateName($name); } - catch (\Twig_Error_Loader $e) + catch (\Twig\Error\LoaderError $e) { if (strpos($e->getRawMessage(), 'Looks like you try to load a template outside configured directories') === 0) { diff --git a/phpBB/phpbb/template/twig/node/definenode.php b/phpBB/phpbb/template/twig/node/definenode.php index 1c51596916..4f963e6680 100644 --- a/phpBB/phpbb/template/twig/node/definenode.php +++ b/phpBB/phpbb/template/twig/node/definenode.php @@ -14,9 +14,9 @@ namespace phpbb\template\twig\node; -class definenode extends \Twig_Node +class definenode extends \Twig\Node\Node { - public function __construct($capture, \Twig_Node $name, \Twig_Node $value, $lineno, $tag = null) + public function __construct($capture, \Twig\Node\Node $name, \Twig\Node\Node $value, $lineno, $tag = null) { parent::__construct(array('name' => $name, 'value' => $value), array('capture' => $capture, 'safe' => false), $lineno, $tag); } @@ -24,9 +24,9 @@ class definenode extends \Twig_Node /** * Compiles the node to PHP. * - * @param \Twig_Compiler A Twig_Compiler instance + * @param \Twig\Compiler A Twig\Compiler instance */ - public function compile(\Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); @@ -37,7 +37,7 @@ class definenode extends \Twig_Node ->subcompile($this->getNode('value')) ; - $compiler->write("\$value = ('' === \$value = ob_get_clean()) ? '' : new \Twig_Markup(\$value, \$this->env->getCharset());\n"); + $compiler->write("\$value = ('' === \$value = ob_get_clean()) ? '' : new \Twig\Markup(\$value, \$this->env->getCharset());\n"); } else { diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index 11fdb75247..9766750500 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig\node; -class event extends \Twig_Node +class event extends \Twig\Node\Node { /** * The subdirectory in which all template listener files must be placed @@ -21,10 +21,10 @@ class event extends \Twig_Node */ protected $listener_directory = 'event/'; - /** @var \Twig_Environment */ + /** @var \Twig\Environment */ protected $environment; - public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null) + public function __construct(\Twig\Node\Expression\AbstractExpression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null) { $this->environment = $environment; @@ -34,9 +34,9 @@ class event extends \Twig_Node /** * Compiles the node to PHP. * - * @param \Twig_Compiler A Twig_Compiler instance + * @param \Twig\Compiler A Twig\Compiler instance */ - public function compile(\Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php index 2cd15d59da..cf11b2876d 100644 --- a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php +++ b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php @@ -13,9 +13,9 @@ namespace phpbb\template\twig\node\expression\binary; -class equalequal extends \Twig_Node_Expression_Binary +class equalequal extends \Twig\Node\Expression\Binary\AbstractBinary { - public function operator(\Twig_Compiler $compiler) + public function operator(\Twig\Compiler $compiler) { return $compiler->raw('==='); } diff --git a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php index 5f2908fb9b..c8b0ac98e8 100644 --- a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php +++ b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php @@ -13,9 +13,9 @@ namespace phpbb\template\twig\node\expression\binary; -class notequalequal extends \Twig_Node_Expression_Binary +class notequalequal extends \Twig\Node\Expression\Binary\AbstractBinary { - public function operator(\Twig_Compiler $compiler) + public function operator(\Twig\Compiler $compiler) { return $compiler->raw('!=='); } diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index bf29fa7277..10b7343d82 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -13,9 +13,9 @@ namespace phpbb\template\twig\node; -abstract class includeasset extends \Twig_Node +abstract class includeasset extends \Twig\Node\Node { - public function __construct(\Twig_Node_Expression $expr, $lineno, $tag = null) + public function __construct(\Twig\Node\Expression\AbstractExpression $expr, $lineno, $tag = null) { parent::__construct(array('expr' => $expr), array(), $lineno, $tag); } @@ -23,9 +23,9 @@ abstract class includeasset extends \Twig_Node /** * Compiles the node to PHP. * - * @param \Twig_Compiler A Twig_Compiler instance + * @param \Twig\Compiler A Twig\Compiler instance */ - public function compile(\Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/phpBB/phpbb/template/twig/node/includenode.php b/phpBB/phpbb/template/twig/node/includenode.php index c36ac3c324..1786b3a430 100644 --- a/phpBB/phpbb/template/twig/node/includenode.php +++ b/phpBB/phpbb/template/twig/node/includenode.php @@ -13,14 +13,14 @@ namespace phpbb\template\twig\node; -class includenode extends \Twig_Node_Include +class includenode extends \Twig\Node\IncludeNode { /** * Compiles the node to PHP. * - * @param \Twig_Compiler A Twig_Compiler instance + * @param \Twig\Compiler A Twig\Compiler instance */ - public function compile(\Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/phpBB/phpbb/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php index 0cf95abe99..045b1a5428 100644 --- a/phpBB/phpbb/template/twig/node/includephp.php +++ b/phpBB/phpbb/template/twig/node/includephp.php @@ -14,12 +14,12 @@ namespace phpbb\template\twig\node; -class includephp extends \Twig_Node +class includephp extends \Twig\Node\Node { - /** @var \Twig_Environment */ + /** @var \Twig\Environment */ protected $environment; - public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $ignoreMissing = false, $tag = null) + public function __construct(\Twig\Node\Expression\AbstractExpression $expr, \phpbb\template\twig\environment $environment, $lineno, $ignoreMissing = false, $tag = null) { $this->environment = $environment; @@ -29,9 +29,9 @@ class includephp extends \Twig_Node /** * Compiles the node to PHP. * - * @param \Twig_Compiler A Twig_Compiler instance + * @param \Twig\Compiler A Twig\Compiler instance */ - public function compile(\Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); @@ -80,7 +80,7 @@ class includephp extends \Twig_Node { $compiler ->outdent() - ->write("} catch (\Twig_Error_Loader \$e) {\n") + ->write("} catch (\Twig\Error\LoaderError \$e) {\n") ->indent() ->write("// ignore missing template\n") ->outdent() diff --git a/phpBB/phpbb/template/twig/node/php.php b/phpBB/phpbb/template/twig/node/php.php index 4ee415e446..fed14d1022 100644 --- a/phpBB/phpbb/template/twig/node/php.php +++ b/phpBB/phpbb/template/twig/node/php.php @@ -13,12 +13,12 @@ namespace phpbb\template\twig\node; -class php extends \Twig_Node +class php extends \Twig\Node\Node { - /** @var \Twig_Environment */ + /** @var \Twig\Environment */ protected $environment; - public function __construct(\Twig_Node_Text $text, \phpbb\template\twig\environment $environment, $lineno, $tag = null) + public function __construct(\Twig\Node\TextNode $text, \phpbb\template\twig\environment $environment, $lineno, $tag = null) { $this->environment = $environment; @@ -28,9 +28,9 @@ class php extends \Twig_Node /** * Compiles the node to PHP. * - * @param \Twig_Compiler A Twig_Compiler instance + * @param \Twig\Compiler A Twig\Compiler instance */ - public function compile(\Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php index 6285091e94..3cb7873652 100644 --- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php @@ -14,52 +14,52 @@ namespace phpbb\template\twig\tokenparser; -class defineparser extends \Twig_TokenParser +class defineparser extends \Twig\TokenParser\AbstractTokenParser { /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A Twig\Token instance * - * @return \Twig_Node A Twig_Node instance - * @throws \Twig_Error_Syntax + * @return \Twig\Node\Node A Twig\Node instance + * @throws \Twig\Error\SyntaxError * @throws \phpbb\template\twig\node\definenode */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $name = $this->parser->getExpressionParser()->parseExpression(); $capture = false; - if ($stream->test(\Twig_Token::OPERATOR_TYPE, '=')) + if ($stream->test(\Twig\Token::OPERATOR_TYPE, '=')) { $stream->next(); $value = $this->parser->getExpressionParser()->parseExpression(); - if ($value instanceof \Twig_Node_Expression_Name) + if ($value instanceof \Twig\Node\Expression\NameExpression) { // This would happen if someone improperly formed their DEFINE syntax // e.g. - throw new \Twig_Error_Syntax('Invalid DEFINE', $token->getLine(), $this->parser->getStream()->getSourceContext()->getPath()); + throw new \Twig\Error\SyntaxError('Invalid DEFINE', $token->getLine(), $this->parser->getStream()->getSourceContext()->getPath()); } - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); } else { $capture = true; - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); $value = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); } return new \phpbb\template\twig\node\definenode($capture, $name, $value, $lineno, $this->getTag()); } - public function decideBlockEnd(\Twig_Token $token) + public function decideBlockEnd(\Twig\Token $token) { return $token->test('ENDDEFINE'); } diff --git a/phpBB/phpbb/template/twig/tokenparser/event.php b/phpBB/phpbb/template/twig/tokenparser/event.php index 92ecff4a74..7b9742cc95 100644 --- a/phpBB/phpbb/template/twig/tokenparser/event.php +++ b/phpBB/phpbb/template/twig/tokenparser/event.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig\tokenparser; -class event extends \Twig_TokenParser +class event extends \Twig\TokenParser\AbstractTokenParser { /** @var \phpbb\template\twig\environment */ protected $environment; @@ -31,16 +31,16 @@ class event extends \Twig_TokenParser /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A Twig\Token instance * - * @return \Twig_Node A Twig_Node instance + * @return \Twig\Node\Node A Twig\Node instance */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); return new \phpbb\template\twig\node\event($expr, $this->environment, $token->getLine(), $this->getTag()); } diff --git a/phpBB/phpbb/template/twig/tokenparser/includecss.php b/phpBB/phpbb/template/twig/tokenparser/includecss.php index f7e55a46fb..606adb4d29 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includecss.php +++ b/phpBB/phpbb/template/twig/tokenparser/includecss.php @@ -13,21 +13,21 @@ namespace phpbb\template\twig\tokenparser; -class includecss extends \Twig_TokenParser +class includecss extends \Twig\TokenParser\AbstractTokenParser { /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A Twig\Token instance * - * @return \Twig_Node A Twig_Node instance + * @return \Twig\Node\Node A Twig\Node instance */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); return new \phpbb\template\twig\node\includecss($expr, $token->getLine(), $this->getTag()); } diff --git a/phpBB/phpbb/template/twig/tokenparser/includejs.php b/phpBB/phpbb/template/twig/tokenparser/includejs.php index 598ea0a70d..6b7a4e26b5 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includejs.php +++ b/phpBB/phpbb/template/twig/tokenparser/includejs.php @@ -13,21 +13,21 @@ namespace phpbb\template\twig\tokenparser; -class includejs extends \Twig_TokenParser +class includejs extends \Twig\TokenParser\AbstractTokenParser { /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A Twig\Token instance * - * @return \Twig_Node A Twig_Node instance + * @return \Twig\Node\Node A Twig\Node instance */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); return new \phpbb\template\twig\node\includejs($expr, $token->getLine(), $this->getTag()); } diff --git a/phpBB/phpbb/template/twig/tokenparser/includeparser.php b/phpBB/phpbb/template/twig/tokenparser/includeparser.php index 2fba4ac4c4..62148489fa 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includeparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/includeparser.php @@ -14,16 +14,16 @@ namespace phpbb\template\twig\tokenparser; -class includeparser extends \Twig_TokenParser_Include +class includeparser extends \Twig\TokenParser\IncludeTokenParser { /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A Twig\Token instance * - * @return \Twig_Node A Twig_Node instance + * @return \Twig\Node\Node A Twig\Node instance */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); diff --git a/phpBB/phpbb/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php index 2fdf396452..a6f8f92139 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includephp.php +++ b/phpBB/phpbb/template/twig/tokenparser/includephp.php @@ -14,7 +14,7 @@ namespace phpbb\template\twig\tokenparser; -class includephp extends \Twig_TokenParser +class includephp extends \Twig\TokenParser\AbstractTokenParser { /** @var \phpbb\template\twig\environment */ protected $environment; @@ -32,26 +32,26 @@ class includephp extends \Twig_TokenParser /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A Twig\Token instance * - * @return \Twig_Node A Twig_Node instance + * @return \Twig\Node\Node A Twig\Node instance */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); $ignoreMissing = false; - if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore')) + if ($stream->test(\Twig\Token::NAME_TYPE, 'ignore')) { $stream->next(); - $stream->expect(\Twig_Token::NAME_TYPE, 'missing'); + $stream->expect(\Twig\Token::NAME_TYPE, 'missing'); $ignoreMissing = true; } - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); return new \phpbb\template\twig\node\includephp($expr, $this->environment, $token->getLine(), $ignoreMissing, $this->getTag()); } diff --git a/phpBB/phpbb/template/twig/tokenparser/php.php b/phpBB/phpbb/template/twig/tokenparser/php.php index 3007912b47..1eab7b794a 100644 --- a/phpBB/phpbb/template/twig/tokenparser/php.php +++ b/phpBB/phpbb/template/twig/tokenparser/php.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig\tokenparser; -class php extends \Twig_TokenParser +class php extends \Twig\TokenParser\AbstractTokenParser { /** @var \phpbb\template\twig\environment */ protected $environment; @@ -31,24 +31,24 @@ class php extends \Twig_TokenParser /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A Twig\Token instance * - * @return \Twig_Node A Twig_Node instance + * @return \Twig\Node\Node A Twig\Node instance */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $stream = $this->parser->getStream(); - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'decideEnd'), true); - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); return new \phpbb\template\twig\node\php($body, $this->environment, $token->getLine(), $this->getTag()); } - public function decideEnd(\Twig_Token $token) + public function decideEnd(\Twig\Token $token) { return $token->test('ENDPHP'); } diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index f0736045de..7a16b86244 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -69,7 +69,7 @@ class twig extends \phpbb\template\base /** * Twig Environment * - * @var \Twig_Environment + * @var \Twig\Environment */ protected $twig;