From 2451c0a815bd7ce5852b319b70ce6cf3a1ad7c4b Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 16:28:49 +0100 Subject: [PATCH 01/14] [ticket/16382] Update Twig_Extension_Debug PHPBB3-16382 --- phpBB/config/default/container/services_twig.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/config/default/container/services_twig.yml b/phpBB/config/default/container/services_twig.yml index 6f70155295..5547ca2608 100644 --- a/phpBB/config/default/container/services_twig.yml +++ b/phpBB/config/default/container/services_twig.yml @@ -68,7 +68,7 @@ services: - { name: twig.extension } template.twig.extensions.debug: - class: Twig_Extension_Debug + class: Twig\Extension\DebugExtension template: class: phpbb\template\twig\twig From b823a94124889296bb232466b3be140c875f3172 Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 16:31:09 +0100 Subject: [PATCH 02/14] [ticket/16382] Update Twig_Compiler PHPBB3-16382 --- phpBB/phpbb/template/twig/node/definenode.php | 4 ++-- phpBB/phpbb/template/twig/node/event.php | 4 ++-- .../phpbb/template/twig/node/expression/binary/equalequal.php | 2 +- .../template/twig/node/expression/binary/notequalequal.php | 2 +- phpBB/phpbb/template/twig/node/includeasset.php | 4 ++-- phpBB/phpbb/template/twig/node/includenode.php | 4 ++-- phpBB/phpbb/template/twig/node/includephp.php | 4 ++-- phpBB/phpbb/template/twig/node/php.php | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/phpBB/phpbb/template/twig/node/definenode.php b/phpBB/phpbb/template/twig/node/definenode.php index 1c51596916..0e31e8b4ce 100644 --- a/phpBB/phpbb/template/twig/node/definenode.php +++ b/phpBB/phpbb/template/twig/node/definenode.php @@ -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); diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index 11fdb75247..9262cfee0d 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -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..31e350a7be 100644 --- a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php +++ b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php @@ -15,7 +15,7 @@ namespace phpbb\template\twig\node\expression\binary; class equalequal extends \Twig_Node_Expression_Binary { - 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..3e7f43d456 100644 --- a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php +++ b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php @@ -15,7 +15,7 @@ namespace phpbb\template\twig\node\expression\binary; class notequalequal extends \Twig_Node_Expression_Binary { - 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 69bfd58803..1c47ef6570 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -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..bfd74dad16 100644 --- a/phpBB/phpbb/template/twig/node/includenode.php +++ b/phpBB/phpbb/template/twig/node/includenode.php @@ -18,9 +18,9 @@ class includenode extends \Twig_Node_Include /** * 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..576bbf3141 100644 --- a/phpBB/phpbb/template/twig/node/includephp.php +++ b/phpBB/phpbb/template/twig/node/includephp.php @@ -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); diff --git a/phpBB/phpbb/template/twig/node/php.php b/phpBB/phpbb/template/twig/node/php.php index 4ee415e446..7db20277f1 100644 --- a/phpBB/phpbb/template/twig/node/php.php +++ b/phpBB/phpbb/template/twig/node/php.php @@ -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); From a4b104c1da36b6685fa57eeb7cb3cfa00f9242c5 Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 16:33:54 +0100 Subject: [PATCH 03/14] [ticket/16382] Update Twig_Source PHPBB3-16382 --- phpBB/phpbb/template/twig/lexer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 10346ac299..56ea1f8930 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -15,7 +15,7 @@ namespace phpbb\template\twig; 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)); } /** From 62a390582c22e2efbfbef68debe9893e20a92c70 Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 16:34:58 +0100 Subject: [PATCH 04/14] [ticket/16382] Update Twig_Lexer PHPBB3-16382 --- phpBB/phpbb/template/twig/lexer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 56ea1f8930..a8424f6f73 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig; -class lexer extends \Twig_Lexer +class lexer extends \Twig\Lexer { public function tokenize(\Twig\Source $source) { From d33407272240154085417ad1b52578e6c3190d7b Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 16:37:09 +0100 Subject: [PATCH 05/14] [ticket/16382] Update Twig_Node_Expression PHPBB3-16382 --- phpBB/phpbb/template/twig/node/event.php | 2 +- phpBB/phpbb/template/twig/node/includeasset.php | 2 +- phpBB/phpbb/template/twig/node/includephp.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index 9262cfee0d..55e6019113 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -24,7 +24,7 @@ class event extends \Twig_Node /** @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; diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index 1c47ef6570..27fe8ee1b4 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -15,7 +15,7 @@ namespace phpbb\template\twig\node; abstract class includeasset extends \Twig_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); } diff --git a/phpBB/phpbb/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php index 576bbf3141..4f06bc0f59 100644 --- a/phpBB/phpbb/template/twig/node/includephp.php +++ b/phpBB/phpbb/template/twig/node/includephp.php @@ -19,7 +19,7 @@ class includephp extends \Twig_Node /** @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; From 3b1f936dcf74b2dadfb8bede35ec563bce07798b Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 16:38:09 +0100 Subject: [PATCH 06/14] [ticket/16382] Update Twig_Node_Expression_Binary PHPBB3-16382 --- phpBB/phpbb/template/twig/node/expression/binary/equalequal.php | 2 +- .../template/twig/node/expression/binary/notequalequal.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php index 31e350a7be..cf11b2876d 100644 --- a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php +++ b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php @@ -13,7 +13,7 @@ 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) { diff --git a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php index 3e7f43d456..c8b0ac98e8 100644 --- a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php +++ b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php @@ -13,7 +13,7 @@ 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) { From dbb9cbe280009f80ded080649396474ef824a1c1 Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 16:39:21 +0100 Subject: [PATCH 07/14] [ticket/16382] Update Twig_Node_Expression_Name PHPBB3-16382 --- phpBB/phpbb/template/twig/tokenparser/defineparser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php index 6285091e94..b04ab85afb 100644 --- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php @@ -37,7 +37,7 @@ class defineparser extends \Twig_TokenParser $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. <!-- DEFINE $VAR = foo --> From b795b8a040e96a6b2f4379264279e2ebcfca3302 Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 16:42:44 +0100 Subject: [PATCH 08/14] [ticket/16382] Update Twig_Token PHPBB3-16382 --- .../template/twig/tokenparser/defineparser.php | 14 +++++++------- phpBB/phpbb/template/twig/tokenparser/event.php | 6 +++--- .../phpbb/template/twig/tokenparser/includecss.php | 6 +++--- .../phpbb/template/twig/tokenparser/includejs.php | 6 +++--- .../template/twig/tokenparser/includeparser.php | 4 ++-- .../phpbb/template/twig/tokenparser/includephp.php | 10 +++++----- phpBB/phpbb/template/twig/tokenparser/php.php | 10 +++++----- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php index b04ab85afb..58b1be7861 100644 --- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php @@ -19,20 +19,20 @@ class defineparser 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 * @throws \Twig_Error_Syntax * @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(); @@ -44,22 +44,22 @@ class defineparser extends \Twig_TokenParser throw new \Twig_Error_Syntax('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..3fe5850afd 100644 --- a/phpBB/phpbb/template/twig/tokenparser/event.php +++ b/phpBB/phpbb/template/twig/tokenparser/event.php @@ -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 */ - 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..b29af79d25 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includecss.php +++ b/phpBB/phpbb/template/twig/tokenparser/includecss.php @@ -18,16 +18,16 @@ class includecss 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 */ - 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..da082f84fb 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includejs.php +++ b/phpBB/phpbb/template/twig/tokenparser/includejs.php @@ -18,16 +18,16 @@ class includejs 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 */ - 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..8442ee5561 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includeparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/includeparser.php @@ -19,11 +19,11 @@ class includeparser extends \Twig_TokenParser_Include /** * 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 */ - 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..e8ca5d2978 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includephp.php +++ b/phpBB/phpbb/template/twig/tokenparser/includephp.php @@ -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 */ - 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..e9decb0b33 100644 --- a/phpBB/phpbb/template/twig/tokenparser/php.php +++ b/phpBB/phpbb/template/twig/tokenparser/php.php @@ -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 */ - 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'); } From 884f48faf62baebf9369a5dc4e82b0a3731159c4 Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 16:44:48 +0100 Subject: [PATCH 09/14] [ticket/16382] Update Twig_TokenParser PHPBB3-16382 --- phpBB/phpbb/template/twig/tokenparser/defineparser.php | 2 +- phpBB/phpbb/template/twig/tokenparser/event.php | 2 +- phpBB/phpbb/template/twig/tokenparser/includecss.php | 2 +- phpBB/phpbb/template/twig/tokenparser/includejs.php | 2 +- phpBB/phpbb/template/twig/tokenparser/includeparser.php | 2 +- phpBB/phpbb/template/twig/tokenparser/includephp.php | 2 +- phpBB/phpbb/template/twig/tokenparser/php.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php index 58b1be7861..30cf871062 100644 --- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php @@ -14,7 +14,7 @@ namespace phpbb\template\twig\tokenparser; -class defineparser extends \Twig_TokenParser +class defineparser extends \Twig\TokenParser\AbstractTokenParser { /** * Parses a token and returns a node. diff --git a/phpBB/phpbb/template/twig/tokenparser/event.php b/phpBB/phpbb/template/twig/tokenparser/event.php index 3fe5850afd..ef56a8719d 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; diff --git a/phpBB/phpbb/template/twig/tokenparser/includecss.php b/phpBB/phpbb/template/twig/tokenparser/includecss.php index b29af79d25..e41ed8ee1c 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includecss.php +++ b/phpBB/phpbb/template/twig/tokenparser/includecss.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig\tokenparser; -class includecss extends \Twig_TokenParser +class includecss extends \Twig\TokenParser\AbstractTokenParser { /** * Parses a token and returns a node. diff --git a/phpBB/phpbb/template/twig/tokenparser/includejs.php b/phpBB/phpbb/template/twig/tokenparser/includejs.php index da082f84fb..f01eb69806 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includejs.php +++ b/phpBB/phpbb/template/twig/tokenparser/includejs.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig\tokenparser; -class includejs extends \Twig_TokenParser +class includejs extends \Twig\TokenParser\AbstractTokenParser { /** * Parses a token and returns a node. diff --git a/phpBB/phpbb/template/twig/tokenparser/includeparser.php b/phpBB/phpbb/template/twig/tokenparser/includeparser.php index 8442ee5561..61d20b72f0 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includeparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/includeparser.php @@ -14,7 +14,7 @@ namespace phpbb\template\twig\tokenparser; -class includeparser extends \Twig_TokenParser_Include +class includeparser extends \Twig\TokenParser\IncludeTokenParser { /** * Parses a token and returns a node. diff --git a/phpBB/phpbb/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php index e8ca5d2978..ff316a4eaa 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; diff --git a/phpBB/phpbb/template/twig/tokenparser/php.php b/phpBB/phpbb/template/twig/tokenparser/php.php index e9decb0b33..5650c9571b 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; From 90c15aeebc32867c7b9465bae92b7f5a9f531640 Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 16:48:21 +0100 Subject: [PATCH 10/14] [ticket/16382] Update Twig_Node PHPBB3-16382 --- phpBB/phpbb/template/twig/node/definenode.php | 4 ++-- phpBB/phpbb/template/twig/node/event.php | 2 +- phpBB/phpbb/template/twig/node/includeasset.php | 2 +- phpBB/phpbb/template/twig/node/includenode.php | 2 +- phpBB/phpbb/template/twig/node/includephp.php | 2 +- phpBB/phpbb/template/twig/node/php.php | 4 ++-- phpBB/phpbb/template/twig/tokenparser/defineparser.php | 2 +- phpBB/phpbb/template/twig/tokenparser/event.php | 2 +- phpBB/phpbb/template/twig/tokenparser/includecss.php | 2 +- phpBB/phpbb/template/twig/tokenparser/includejs.php | 2 +- phpBB/phpbb/template/twig/tokenparser/includeparser.php | 2 +- phpBB/phpbb/template/twig/tokenparser/includephp.php | 2 +- phpBB/phpbb/template/twig/tokenparser/php.php | 2 +- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/phpBB/phpbb/template/twig/node/definenode.php b/phpBB/phpbb/template/twig/node/definenode.php index 0e31e8b4ce..fb5053ac18 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); } diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index 55e6019113..cff29afef0 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 diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index 27fe8ee1b4..cf9beeac9b 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig\node; -abstract class includeasset extends \Twig_Node +abstract class includeasset extends \Twig\Node\Node { public function __construct(\Twig\Node\Expression\AbstractExpression $expr, $lineno, $tag = null) { diff --git a/phpBB/phpbb/template/twig/node/includenode.php b/phpBB/phpbb/template/twig/node/includenode.php index bfd74dad16..2887d1a725 100644 --- a/phpBB/phpbb/template/twig/node/includenode.php +++ b/phpBB/phpbb/template/twig/node/includenode.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig\node; -class includenode extends \Twig_Node_Include +class includenode extends \Twig\Node\IncludeNode { /** * Compiles the node to PHP. diff --git a/phpBB/phpbb/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php index 4f06bc0f59..0011f67e37 100644 --- a/phpBB/phpbb/template/twig/node/includephp.php +++ b/phpBB/phpbb/template/twig/node/includephp.php @@ -14,7 +14,7 @@ namespace phpbb\template\twig\node; -class includephp extends \Twig_Node +class includephp extends \Twig\Node\Node { /** @var \Twig_Environment */ protected $environment; diff --git a/phpBB/phpbb/template/twig/node/php.php b/phpBB/phpbb/template/twig/node/php.php index 7db20277f1..46c1dde5d8 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 */ 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; diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php index 30cf871062..08696b4ca4 100644 --- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php @@ -21,7 +21,7 @@ class defineparser extends \Twig\TokenParser\AbstractTokenParser * * @param \Twig\Token $token A Twig_Token instance * - * @return \Twig_Node A Twig_Node instance + * @return \Twig\Node\Node A Twig_Node instance * @throws \Twig_Error_Syntax * @throws \phpbb\template\twig\node\definenode */ diff --git a/phpBB/phpbb/template/twig/tokenparser/event.php b/phpBB/phpbb/template/twig/tokenparser/event.php index ef56a8719d..5aae2721c8 100644 --- a/phpBB/phpbb/template/twig/tokenparser/event.php +++ b/phpBB/phpbb/template/twig/tokenparser/event.php @@ -33,7 +33,7 @@ class event extends \Twig\TokenParser\AbstractTokenParser * * @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) { diff --git a/phpBB/phpbb/template/twig/tokenparser/includecss.php b/phpBB/phpbb/template/twig/tokenparser/includecss.php index e41ed8ee1c..72e2bc96dd 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includecss.php +++ b/phpBB/phpbb/template/twig/tokenparser/includecss.php @@ -20,7 +20,7 @@ class includecss extends \Twig\TokenParser\AbstractTokenParser * * @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) { diff --git a/phpBB/phpbb/template/twig/tokenparser/includejs.php b/phpBB/phpbb/template/twig/tokenparser/includejs.php index f01eb69806..4f5b67696e 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includejs.php +++ b/phpBB/phpbb/template/twig/tokenparser/includejs.php @@ -20,7 +20,7 @@ class includejs extends \Twig\TokenParser\AbstractTokenParser * * @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) { diff --git a/phpBB/phpbb/template/twig/tokenparser/includeparser.php b/phpBB/phpbb/template/twig/tokenparser/includeparser.php index 61d20b72f0..5ff2582e35 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includeparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/includeparser.php @@ -21,7 +21,7 @@ class includeparser extends \Twig\TokenParser\IncludeTokenParser * * @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) { diff --git a/phpBB/phpbb/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php index ff316a4eaa..02b565c297 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includephp.php +++ b/phpBB/phpbb/template/twig/tokenparser/includephp.php @@ -34,7 +34,7 @@ class includephp extends \Twig\TokenParser\AbstractTokenParser * * @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) { diff --git a/phpBB/phpbb/template/twig/tokenparser/php.php b/phpBB/phpbb/template/twig/tokenparser/php.php index 5650c9571b..38ecba77ca 100644 --- a/phpBB/phpbb/template/twig/tokenparser/php.php +++ b/phpBB/phpbb/template/twig/tokenparser/php.php @@ -33,7 +33,7 @@ class php extends \Twig\TokenParser\AbstractTokenParser * * @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) { From 07b2046685381813eb3bdf2a68ea36c8848af5be Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 16:51:06 +0100 Subject: [PATCH 11/14] [ticket/16382] Update Twig_Loader PHPBB3-16382 --- phpBB/phpbb/template/twig/environment.php | 4 ++-- phpBB/phpbb/template/twig/loader.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index ac4b16e457..0b038ac612 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -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; diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php index 0f193dbe59..66e95b3d2a 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -16,7 +16,7 @@ namespace phpbb\template\twig; /** * Twig Template loader */ -class loader extends \Twig_Loader_Filesystem +class loader extends \Twig\Loader\FilesystemLoader { protected $safe_directories = array(); @@ -42,7 +42,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()) { @@ -63,7 +63,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) { From 8a040f3fbc332d52a7dce6d78446c470147767d8 Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 16:53:10 +0100 Subject: [PATCH 12/14] [ticket/16382] Update Twig_Loader_Filesystem PHPBB3-16382 --- phpBB/phpbb/template/twig/loader.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php index 66e95b3d2a..d4001082ac 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -111,11 +111,11 @@ class loader extends \Twig\Loader\FilesystemLoader } /** - * 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; From 75c25556aa45d0c0c7fff063f60f2806874a48f0 Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 16:55:54 +0100 Subject: [PATCH 13/14] [ticket/16382] Update Twig_Environment PHPBB3-16382 --- phpBB/phpbb/feed/controller/feed.php | 9 +++++---- phpBB/phpbb/template/twig/environment.php | 4 ++-- phpBB/phpbb/template/twig/extension.php | 4 ++-- phpBB/phpbb/template/twig/node/event.php | 2 +- phpBB/phpbb/template/twig/node/includephp.php | 2 +- phpBB/phpbb/template/twig/node/php.php | 2 +- phpBB/phpbb/template/twig/twig.php | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) 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 0b038ac612..bbf1142939 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; @@ -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) { diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index 1131a7f3aa..5e2d2a8147 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -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/node/event.php b/phpBB/phpbb/template/twig/node/event.php index cff29afef0..97116077af 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -21,7 +21,7 @@ class event extends \Twig\Node\Node */ protected $listener_directory = 'event/'; - /** @var \Twig_Environment */ + /** @var \Twig\Environment */ protected $environment; public function __construct(\Twig\Node\Expression\AbstractExpression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null) diff --git a/phpBB/phpbb/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php index 0011f67e37..83625f3c63 100644 --- a/phpBB/phpbb/template/twig/node/includephp.php +++ b/phpBB/phpbb/template/twig/node/includephp.php @@ -16,7 +16,7 @@ namespace phpbb\template\twig\node; class includephp extends \Twig\Node\Node { - /** @var \Twig_Environment */ + /** @var \Twig\Environment */ protected $environment; public function __construct(\Twig\Node\Expression\AbstractExpression $expr, \phpbb\template\twig\environment $environment, $lineno, $ignoreMissing = false, $tag = null) diff --git a/phpBB/phpbb/template/twig/node/php.php b/phpBB/phpbb/template/twig/node/php.php index 46c1dde5d8..2823b11150 100644 --- a/phpBB/phpbb/template/twig/node/php.php +++ b/phpBB/phpbb/template/twig/node/php.php @@ -15,7 +15,7 @@ namespace phpbb\template\twig\node; class php extends \Twig\Node\Node { - /** @var \Twig_Environment */ + /** @var \Twig\Environment */ protected $environment; public function __construct(\Twig\Node\TextNode $text, \phpbb\template\twig\environment $environment, $lineno, $tag = null) diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index f322778eda..af77335b9d 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; From 49845c1155caca5169c51f8424ffdf098dbe6da2 Mon Sep 17 00:00:00 2001 From: mrgoldy <gijsmartens1@gmail.com> Date: Thu, 27 Feb 2020 17:15:31 +0100 Subject: [PATCH 14/14] [ticket/16382] Update remaining Twig_ references PHPBB3-16382 --- phpBB/phpbb/template/twig/environment.php | 10 ++-- phpBB/phpbb/template/twig/extension.php | 46 +++++++++---------- .../phpbb/template/twig/extension/avatar.php | 2 +- .../phpbb/template/twig/extension/config.php | 2 +- .../template/twig/extension/username.php | 2 +- phpBB/phpbb/template/twig/loader.php | 2 +- phpBB/phpbb/template/twig/node/definenode.php | 4 +- phpBB/phpbb/template/twig/node/event.php | 2 +- .../phpbb/template/twig/node/includeasset.php | 2 +- .../phpbb/template/twig/node/includenode.php | 2 +- phpBB/phpbb/template/twig/node/includephp.php | 4 +- phpBB/phpbb/template/twig/node/php.php | 2 +- .../twig/tokenparser/defineparser.php | 8 ++-- .../phpbb/template/twig/tokenparser/event.php | 4 +- .../template/twig/tokenparser/includecss.php | 4 +- .../template/twig/tokenparser/includejs.php | 4 +- .../twig/tokenparser/includeparser.php | 4 +- .../template/twig/tokenparser/includephp.php | 4 +- phpBB/phpbb/template/twig/tokenparser/php.php | 4 +- 19 files changed, 56 insertions(+), 56 deletions(-) diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index bbf1142939..27426606aa 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -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 5e2d2a8147..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), ), ); } 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/loader.php b/phpBB/phpbb/template/twig/loader.php index d4001082ac..ccc64d0ddc 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -139,7 +139,7 @@ class loader extends \Twig\Loader\FilesystemLoader // 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 fb5053ac18..4f963e6680 100644 --- a/phpBB/phpbb/template/twig/node/definenode.php +++ b/phpBB/phpbb/template/twig/node/definenode.php @@ -24,7 +24,7 @@ class definenode extends \Twig\Node\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) { @@ -37,7 +37,7 @@ class definenode extends \Twig\Node\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 97116077af..9766750500 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -34,7 +34,7 @@ class event extends \Twig\Node\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) { diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index cf9beeac9b..8deca24e76 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -23,7 +23,7 @@ abstract class includeasset extends \Twig\Node\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) { diff --git a/phpBB/phpbb/template/twig/node/includenode.php b/phpBB/phpbb/template/twig/node/includenode.php index 2887d1a725..1786b3a430 100644 --- a/phpBB/phpbb/template/twig/node/includenode.php +++ b/phpBB/phpbb/template/twig/node/includenode.php @@ -18,7 +18,7 @@ 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) { diff --git a/phpBB/phpbb/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php index 83625f3c63..045b1a5428 100644 --- a/phpBB/phpbb/template/twig/node/includephp.php +++ b/phpBB/phpbb/template/twig/node/includephp.php @@ -29,7 +29,7 @@ class includephp extends \Twig\Node\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) { @@ -80,7 +80,7 @@ class includephp extends \Twig\Node\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 2823b11150..fed14d1022 100644 --- a/phpBB/phpbb/template/twig/node/php.php +++ b/phpBB/phpbb/template/twig/node/php.php @@ -28,7 +28,7 @@ class php extends \Twig\Node\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) { diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php index 08696b4ca4..3cb7873652 100644 --- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php @@ -19,10 +19,10 @@ 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\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) @@ -41,7 +41,7 @@ class defineparser extends \Twig\TokenParser\AbstractTokenParser { // This would happen if someone improperly formed their DEFINE syntax // e.g. <!-- DEFINE $VAR = foo --> - 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); diff --git a/phpBB/phpbb/template/twig/tokenparser/event.php b/phpBB/phpbb/template/twig/tokenparser/event.php index 5aae2721c8..7b9742cc95 100644 --- a/phpBB/phpbb/template/twig/tokenparser/event.php +++ b/phpBB/phpbb/template/twig/tokenparser/event.php @@ -31,9 +31,9 @@ class event 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\Node A Twig_Node instance + * @return \Twig\Node\Node A Twig\Node instance */ public function parse(\Twig\Token $token) { diff --git a/phpBB/phpbb/template/twig/tokenparser/includecss.php b/phpBB/phpbb/template/twig/tokenparser/includecss.php index 72e2bc96dd..606adb4d29 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includecss.php +++ b/phpBB/phpbb/template/twig/tokenparser/includecss.php @@ -18,9 +18,9 @@ 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\Node A Twig_Node instance + * @return \Twig\Node\Node A Twig\Node instance */ public function parse(\Twig\Token $token) { diff --git a/phpBB/phpbb/template/twig/tokenparser/includejs.php b/phpBB/phpbb/template/twig/tokenparser/includejs.php index 4f5b67696e..6b7a4e26b5 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includejs.php +++ b/phpBB/phpbb/template/twig/tokenparser/includejs.php @@ -18,9 +18,9 @@ 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\Node A Twig_Node instance + * @return \Twig\Node\Node A Twig\Node instance */ public function parse(\Twig\Token $token) { diff --git a/phpBB/phpbb/template/twig/tokenparser/includeparser.php b/phpBB/phpbb/template/twig/tokenparser/includeparser.php index 5ff2582e35..62148489fa 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includeparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/includeparser.php @@ -19,9 +19,9 @@ 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\Node A Twig_Node instance + * @return \Twig\Node\Node A Twig\Node instance */ public function parse(\Twig\Token $token) { diff --git a/phpBB/phpbb/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php index 02b565c297..a6f8f92139 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includephp.php +++ b/phpBB/phpbb/template/twig/tokenparser/includephp.php @@ -32,9 +32,9 @@ class includephp 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\Node A Twig_Node instance + * @return \Twig\Node\Node A Twig\Node instance */ public function parse(\Twig\Token $token) { diff --git a/phpBB/phpbb/template/twig/tokenparser/php.php b/phpBB/phpbb/template/twig/tokenparser/php.php index 38ecba77ca..1eab7b794a 100644 --- a/phpBB/phpbb/template/twig/tokenparser/php.php +++ b/phpBB/phpbb/template/twig/tokenparser/php.php @@ -31,9 +31,9 @@ class php 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\Node A Twig_Node instance + * @return \Twig\Node\Node A Twig\Node instance */ public function parse(\Twig\Token $token) {