Skip to content

Commit 3864e8f

Browse files
committed
Merge branch '5.4' into 6.4
* 5.4: fix Twig 3.12 compatibility [Translation] Review Serbian translations Fix typos [DependencyInjection] Fix error message typo in YamlFileLoader
2 parents ffe40c6 + e014da0 commit 3864e8f

File tree

13 files changed

+66
-35
lines changed

13 files changed

+66
-35
lines changed

src/Symfony/Bridge/Twig/Node/DumpNode.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Twig\Node;
1313

14+
use Twig\Attribute\FirstClassTwigCallableReady;
1415
use Twig\Attribute\YieldReady;
1516
use Twig\Compiler;
1617
use Twig\Node\Node;
@@ -30,7 +31,12 @@ public function __construct(string $varPrefix, ?Node $values, int $lineno, ?stri
3031
$nodes['values'] = $values;
3132
}
3233

33-
parent::__construct($nodes, [], $lineno, $tag);
34+
if (class_exists(FirstClassTwigCallableReady::class)) {
35+
parent::__construct($nodes, [], $lineno);
36+
} else {
37+
parent::__construct($nodes, [], $lineno, $tag);
38+
}
39+
3440
$this->varPrefix = $varPrefix;
3541
}
3642

src/Symfony/Bridge/Twig/Node/FormThemeNode.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bridge\Twig\Node;
1313

1414
use Symfony\Component\Form\FormRenderer;
15+
use Twig\Attribute\FirstClassTwigCallableReady;
1516
use Twig\Attribute\YieldReady;
1617
use Twig\Compiler;
1718
use Twig\Node\Node;
@@ -24,7 +25,11 @@ final class FormThemeNode extends Node
2425
{
2526
public function __construct(Node $form, Node $resources, int $lineno, ?string $tag = null, bool $only = false)
2627
{
27-
parent::__construct(['form' => $form, 'resources' => $resources], ['only' => $only], $lineno, $tag);
28+
if (class_exists(FirstClassTwigCallableReady::class)) {
29+
parent::__construct(['form' => $form, 'resources' => $resources], ['only' => $only], $lineno);
30+
} else {
31+
parent::__construct(['form' => $form, 'resources' => $resources], ['only' => $only], $lineno, $tag);
32+
}
2833
}
2934

3035
public function compile(Compiler $compiler): void

src/Symfony/Bridge/Twig/Node/StopwatchNode.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Twig\Node;
1313

14+
use Twig\Attribute\FirstClassTwigCallableReady;
1415
use Twig\Attribute\YieldReady;
1516
use Twig\Compiler;
1617
use Twig\Node\Expression\AssignNameExpression;
@@ -26,7 +27,11 @@ final class StopwatchNode extends Node
2627
{
2728
public function __construct(Node $name, Node $body, AssignNameExpression $var, int $lineno = 0, ?string $tag = null)
2829
{
29-
parent::__construct(['body' => $body, 'name' => $name, 'var' => $var], [], $lineno, $tag);
30+
if (class_exists(FirstClassTwigCallableReady::class)) {
31+
parent::__construct(['body' => $body, 'name' => $name, 'var' => $var], [], $lineno);
32+
} else {
33+
parent::__construct(['body' => $body, 'name' => $name, 'var' => $var], [], $lineno, $tag);
34+
}
3035
}
3136

3237
public function compile(Compiler $compiler): void

src/Symfony/Bridge/Twig/Node/TransDefaultDomainNode.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Twig\Node;
1313

14+
use Twig\Attribute\FirstClassTwigCallableReady;
1415
use Twig\Attribute\YieldReady;
1516
use Twig\Compiler;
1617
use Twig\Node\Expression\AbstractExpression;
@@ -24,7 +25,11 @@ final class TransDefaultDomainNode extends Node
2425
{
2526
public function __construct(AbstractExpression $expr, int $lineno = 0, ?string $tag = null)
2627
{
27-
parent::__construct(['expr' => $expr], [], $lineno, $tag);
28+
if (class_exists(FirstClassTwigCallableReady::class)) {
29+
parent::__construct(['expr' => $expr], [], $lineno);
30+
} else {
31+
parent::__construct(['expr' => $expr], [], $lineno, $tag);
32+
}
2833
}
2934

3035
public function compile(Compiler $compiler): void

src/Symfony/Bridge/Twig/Node/TransNode.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Twig\Node;
1313

14+
use Twig\Attribute\FirstClassTwigCallableReady;
1415
use Twig\Attribute\YieldReady;
1516
use Twig\Compiler;
1617
use Twig\Node\Expression\AbstractExpression;
@@ -42,7 +43,11 @@ public function __construct(Node $body, ?Node $domain = null, ?AbstractExpressio
4243
$nodes['locale'] = $locale;
4344
}
4445

45-
parent::__construct($nodes, [], $lineno, $tag);
46+
if (class_exists(FirstClassTwigCallableReady::class)) {
47+
parent::__construct($nodes, [], $lineno);
48+
} else {
49+
parent::__construct($nodes, [], $lineno, $tag);
50+
}
4651
}
4752

4853
public function compile(Compiler $compiler): void

src/Symfony/Bridge/Twig/Tests/TokenParser/FormThemeTokenParserTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bridge\Twig\Node\FormThemeNode;
1616
use Symfony\Bridge\Twig\TokenParser\FormThemeTokenParser;
17+
use Twig\Attribute\FirstClassTwigCallableReady;
1718
use Twig\Environment;
1819
use Twig\Loader\LoaderInterface;
1920
use Twig\Node\Expression\ArrayExpression;
@@ -35,6 +36,10 @@ public function testCompile($source, $expected)
3536
$stream = $env->tokenize($source);
3637
$parser = new Parser($env);
3738

39+
if (class_exists(FirstClassTwigCallableReady::class)) {
40+
$expected->setNodeTag('form_theme');
41+
}
42+
3843
$expected->setSourceContext($source);
3944

4045
$this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0));

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ private function parseDefinition(string $id, array|string|null $service, string
557557
}
558558

559559
if (\is_string($k)) {
560-
throw new InvalidArgumentException(sprintf('Invalid method call for service "%s", did you forgot a leading dash before "%s: ..." in "%s"?', $id, $k, $file));
560+
throw new InvalidArgumentException(sprintf('Invalid method call for service "%s", did you forget a leading dash before "%s: ..." in "%s"?', $id, $k, $file));
561561
}
562562

563563
if (isset($call['method']) && \is_string($call['method'])) {

src/Symfony/Component/Routing/Loader/AttributeFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function findClass(string $file): string|false
8282
$tokens = token_get_all(file_get_contents($file));
8383

8484
if (1 === \count($tokens) && \T_INLINE_HTML === $tokens[0][0]) {
85-
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain PHP code. Did you forgot to add the "<?php" start tag at the beginning of the file?', $file));
85+
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain PHP code. Did you forget to add the "<?php" start tag at the beginning of the file?', $file));
8686
}
8787

8888
$nsTokens = [\T_NS_SEPARATOR => true, \T_STRING => true];

src/Symfony/Component/Routing/Tests/Loader/AttributeFileLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testLoadTraitWithClassConstant()
5858
public function testLoadFileWithoutStartTag()
5959
{
6060
$this->expectException(\InvalidArgumentException::class);
61-
$this->expectExceptionMessage('Did you forgot to add the "<?php" start tag at the beginning of the file?');
61+
$this->expectExceptionMessage('Did you forget to add the "<?php" start tag at the beginning of the file?');
6262
$this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/NoStartTagClass.php');
6363
}
6464

src/Symfony/Component/Security/Core/Resources/translations/security.sr_Cyrl.xlf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
</trans-unit>
7777
<trans-unit id="20">
7878
<source>Too many failed login attempts, please try again in %minutes% minutes.</source>
79-
<target state="needs-review-translation">Превише неуспешних покушаја пријављивања, покушајте поново за %minutes% минут.|Превише неуспешних покушаја пријављивања, покушајте поново за %minutes% минута.|Превише неуспешних покушаја пријављивања, покушајте поново за %minutes% минута.</target>
79+
<target>Превише неуспешних покушаја пријављивања, покушајте поново за %minutes% минут.|Превише неуспешних покушаја пријављивања, покушајте поново за %minutes% минута.</target>
8080
</trans-unit>
8181
</body>
8282
</file>

0 commit comments

Comments
 (0)