mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-14 12:52:08 +02:00
[ticket/16382] Update Twig_Token
PHPBB3-16382
This commit is contained in:
parent
dbb9cbe280
commit
b795b8a040
phpBB/phpbb/template/twig/tokenparser
@ -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');
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user