Skip to content

Commit

Permalink
bug #29875 [TwigBridge] fix compatibility with Twig >= 2.6.1 (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.4 branch.

Discussion
----------

[TwigBridge] fix compatibility with Twig >= 2.6.1

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | twigphp/Twig#2803
| License       | MIT
| Doc PR        |

Commits
-------

40089fb fix compatibility with Twig >= 2.6.1
  • Loading branch information
fabpot committed Jan 14, 2019
2 parents 51d4ca3 + 40089fb commit facbaa5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -68,7 +68,7 @@ public function parse(Token $token)
$body = $this->parser->subparse(array($this, 'decideTransChoiceFork'), true);

if (!$body instanceof TextNode && !$body instanceof AbstractExpression) {
throw new SyntaxError('A message inside a transchoice tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext()->getName());
throw new SyntaxError('A message inside a transchoice tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext());
}

$stream->expect(Token::BLOCK_END_TYPE);
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php
Expand Up @@ -60,7 +60,7 @@ public function parse(Token $token)
$stream->next();
$locale = $this->parser->getExpressionParser()->parseExpression();
} elseif (!$stream->test(Token::BLOCK_END_TYPE)) {
throw new SyntaxError('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getSourceContext()->getName());
throw new SyntaxError('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
}
}

Expand All @@ -69,7 +69,7 @@ public function parse(Token $token)
$body = $this->parser->subparse(array($this, 'decideTransFork'), true);

if (!$body instanceof TextNode && !$body instanceof AbstractExpression) {
throw new SyntaxError('A message inside a trans tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext()->getName());
throw new SyntaxError('A message inside a trans tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext());
}

$stream->expect(Token::BLOCK_END_TYPE);
Expand Down

0 comments on commit facbaa5

Please sign in to comment.