8000 minor #59778 [TwigBridge] Remove legacy code (alexandre-daubois) · symfony/symfony@ab8a96f · GitHub
[go: up one dir, main page]

Skip to content

Commit ab8a96f

Browse files
minor #59778 [TwigBridge] Remove legacy code (alexandre-daubois)
This PR was merged into the 7.3 branch. Discussion ---------- [TwigBridge] Remove legacy code | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | Fix #59774 (review) | License | MIT As suggested in the linked comment. Commits ------- ef65035 [TwigBridge] Remove legacy code
2 parents 0dfb1ec + ef65035 commit ab8a96f

File tree

6 files changed

+11
-24
lines changed

6 files changed

+11
-24
lines changed

src/Symfony/Bridge/Twig/TokenParser/DumpTokenParser.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ public function parse(Token $token): Node
3535
{
3636
$values = null;
3737
if (!$this->parser->getStream()->test(Token::BLOCK_END_TYPE)) {
38-
$values = method_exists($this->parser, 'parseExpression') ?
39-
$this->parseMultitargetExpression() :
40-
$this->parser->getExpressionParser()->parseMultitargetExpression();
38+
$values = $this->parseMultitargetExpression();
4139
}
4240
$this->parser->getStream()->expect(Token::BLOCK_END_TYPE);
4341

src/Symfony/Bridge/Twig/TokenParser/FormThemeTokenParser.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,20 @@ public function parse(Token $token): Node
2929
$lineno = $token->getLine();
3030
$stream = $this->parser->getStream();
3131

32-
$parseExpression = method_exists($this->parser, 'parseExpression')
33-
? $this->parser->parseExpression(...)
34-
: $this->parser->getExpressionParser()->parseExpression(...);
35-
36-
$form = $parseExpression();
32+
$form = $this->parser->parseExpression();
3733
$only = false;
3834

3935
if ($this->parser->getStream()->test(Token::NAME_TYPE, 'with')) {
4036
$this->parser->getStream()->next();
41-
$resources = $parseExpression();
37+
$resources = $this->parser->parseExpression();
4238

4339
if ($this->parser->getStream()->nextIf(Token::NAME_TYPE, 'only')) {
4440
$only = true;
4541
}
4642
} else {
4743
$resources = new ArrayExpression([], $stream->getCurrent()->getLine());
4844
do {
49-
$resources->addElement($parseExpression());
45+
$resources->addElement($this->parser->parseExpression());
5046
} while (!$stream->test(Token::BLOCK_END_TYPE));
5147
}
5248

src/Symfony/Bridge/Twig/TokenParser/StopwatchTokenParser.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ public function parse(Token $token): Node
3636
$stream = $this->parser->getStream();
3737

3838
// {% stopwatch 'bar' %}
39-
$name = method_exists($this->parser, 'parseExpression') ?
40-
$this->parser->parseExpression() :
41-
$this->parser->getExpressionParser()->parseExpression();
39+
$name = $this->parser->parseExpression();
4240

4341
$stream->expect(Token::BLOCK_END_TYPE);
4442

src/Symfony/Bridge/Twig/TokenParser/TransDefaultDomainTokenParser.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ final class TransDefaultDomainTokenParser extends AbstractTokenParser
2525
{
2626
public function parse(Token $token): Node
2727
{
28-
$expr = method_exists($this->parser, 'parseExpression') ?
29-
$this->parser->parseExpression() :
30-
$this->parser->getExpressionParser()->parseExpression();
28+
$expr = $this->parser->parseExpression();
3129

3230
$this->parser->getStream()->expect(Token::BLOCK_END_TYPE);
3331

src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,30 @@ public function parse(Token $token): Node
3636
$vars = new ArrayExpression([], $lineno);
3737
$domain = null;
3838
$locale = null;
39-
$parseExpression = method_exists($this->parser, 'parseExpression')
40-
? $this->parser->parseExpression(...)
41-
: $this->parser->getExpressionParser()->parseExpression(...);
4239

4340
if (!$stream->test(Token::BLOCK_END_TYPE)) {
4441
if ($stream->test('count')) {
4542
// {% trans count 5 %}
4643
$stream->next();
47-
$count = $parseExpression();
44+
$count = $this->parser->parseExpression();
4845
}
4946

5047
if ($stream->test('with')) {
5148
// {% trans with vars %}
5249
$stream->next();
53-
$vars = $parseExpression();
50+
$vars = $this->parser->parseExpression();
5451
}
5552

5653
if ($stream->test('from')) {
5754
// {% trans from "messages" %}
5855
$stream->next();
59-
$domain = $parseExpression();
56+
$domain = $this->parser->parseExpression();
6057
}
6158

6259
if ($stream AF10 ->test('into')) {
6360
// {% trans into "fr" %}
6461
$stream->next();
65-
$locale = $parseExpression();
62+
$locale = $this->parser->parseExpression();
6663
} elseif (!$stream->test(Token::BLOCK_END_TYPE)) {
6764
throw new SyntaxError('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getSourceContext());
6865
}

src/Symfony/Bridge/Twig/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"php": ">=8.2",
2020
"symfony/deprecation-contracts": "^2.5|^3",
2121
"symfony/translation-contracts": "^2.5|^3",
22-
"twig/twig": "^3.12"
22+
"twig/twig": "^3.21"
2323
},
2424
"require-dev": {
2525
"egulias/email-validator": "^2.1.10|^3|^4",

0 commit comments

Comments
 (0)
0