mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 17:54:55 +02:00
Update Twig to v2.15.4
This commit is contained in:
@@ -26,16 +26,14 @@ use Twig\Token;
|
||||
* <link rel="stylesheet" href="style.css" />
|
||||
* <title>{% block title %}{% endblock %} - My Webpage</title>
|
||||
* {% endblock %}
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class BlockTokenParser extends AbstractTokenParser
|
||||
final class BlockTokenParser extends AbstractTokenParser
|
||||
{
|
||||
public function parse(Token $token)
|
||||
{
|
||||
$lineno = $token->getLine();
|
||||
$stream = $this->parser->getStream();
|
||||
$name = $stream->expect(Token::NAME_TYPE)->getValue();
|
||||
$name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue();
|
||||
if ($this->parser->hasBlock($name)) {
|
||||
throw new SyntaxError(sprintf("The block '%s' has already been defined line %d.", $name, $this->parser->getBlock($name)->getTemplateLine()), $stream->getCurrent()->getLine(), $stream->getSourceContext());
|
||||
}
|
||||
@@ -43,9 +41,9 @@ class BlockTokenParser extends AbstractTokenParser
|
||||
$this->parser->pushLocalScope();
|
||||
$this->parser->pushBlockStack($name);
|
||||
|
||||
if ($stream->nextIf(Token::BLOCK_END_TYPE)) {
|
||||
if ($stream->nextIf(/* Token::BLOCK_END_TYPE */ 3)) {
|
||||
$body = $this->parser->subparse([$this, 'decideBlockEnd'], true);
|
||||
if ($token = $stream->nextIf(Token::NAME_TYPE)) {
|
||||
if ($token = $stream->nextIf(/* Token::NAME_TYPE */ 5)) {
|
||||
$value = $token->getValue();
|
||||
|
||||
if ($value != $name) {
|
||||
@@ -57,7 +55,7 @@ class BlockTokenParser extends AbstractTokenParser
|
||||
new PrintNode($this->parser->getExpressionParser()->parseExpression(), $lineno),
|
||||
]);
|
||||
}
|
||||
$stream->expect(Token::BLOCK_END_TYPE);
|
||||
$stream->expect(/* Token::BLOCK_END_TYPE */ 3);
|
||||
|
||||
$block->setNode('body', $body);
|
||||
$this->parser->popBlockStack();
|
||||
|
Reference in New Issue
Block a user