Skip to content

Commit ae5078d

Browse files
committed
Merge branch '4.1.x'
Signed-off-by: Maurício Meneghini Fauth <[email protected]>
2 parents 5bb71fd + 9e3bbae commit ae5078d

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
* Drop support for PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0 and PHP 8.1
99
* Fix Twig deprecations (#16, #17, #18)
1010

11+
## [4.1.4] - 2025-09-14
12+
13+
* Fix some Twig deprecations (#23)
14+
* Improve Twig's environment version check
15+
1116
## [4.1.3] - 2024-09-08
1217

1318
* Add support for Twig 3.13 (#15)
@@ -56,6 +61,7 @@
5661
* First release of this library.
5762

5863
[Unreleased]: https://github.com/phpmyadmin/twig-i18n-extension/compare/4.1.x...HEAD
64+
[4.1.4]: https://github.com/phpmyadmin/twig-i18n-extension/compare/4.1.3...4.1.4
5965
[4.1.3]: https://github.com/phpmyadmin/twig-i18n-extension/compare/4.1.2...4.1.3
6066
[4.1.2]: https://github.com/phpmyadmin/twig-i18n-extension/compare/4.1.1...4.1.2
6167
[4.1.1]: https://github.com/phpmyadmin/twig-i18n-extension/compare/4.1.0...4.1.1

src/TokenParser/TransTokenParser.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
use Twig\Token;
2626
use Twig\TokenParser\AbstractTokenParser;
2727

28+
use function method_exists;
29+
2830
class TransTokenParser extends AbstractTokenParser
2931
{
3032
/**
@@ -60,18 +62,24 @@ protected function preParse(Token $token): array
6062
/* If we aren't closing the block, do we have a domain? */
6163
if ($stream->test(Token::NAME_TYPE)) {
6264
$stream->expect(Token::NAME_TYPE, 'from');
63-
$domain = $this->parser->getExpressionParser()->parseExpression();
65+
$domain = method_exists($this->parser, 'parseExpression')
66+
? $this->parser->parseExpression()
67+
: $this->parser->getExpressionParser()->parseExpression();
6468
}
6569

6670
if (! $stream->test(Token::BLOCK_END_TYPE)) {
67-
$body = $this->parser->getExpressionParser()->parseExpression();
71+
$body = method_exists($this->parser, 'parseExpression')
72+
? $this->parser->parseExpression()
73+
: $this->parser->getExpressionParser()->parseExpression();
6874
} else {
6975
$stream->expect(Token::BLOCK_END_TYPE);
7076
$body = $this->parser->subparse([$this, 'decideForFork']);
7177
$next = $stream->next()->getValue();
7278

7379
if ($next === 'plural') {
74-
$count = $this->parser->getExpressionParser()->parseExpression();
80+
$count = method_exists($this->parser, 'parseExpression')
81+
? $this->parser->parseExpression()
82+
: $this->parser->getExpressionParser()->parseExpression();
7583
$stream->expect(Token::BLOCK_END_TYPE);
7684
$plural = $this->parser->subparse([$this, 'decideForFork']);
7785
$next = $stream->next()->getValue();

0 commit comments

Comments
 (0)