8000 Merge branch '5.3' into 5.4 · symfony/symfony@281c697 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 281c697

Browse files
committed
Merge branch '5.3' into 5.4
* 5.3: Use GitHub issue form templates Add missing translations for Persian (fa) Add the missing translations for Bahasa Indonesia (id) Update README.md Fix deprecations on PHP 8.2 [DependencyInjection] Fix autowiring tagged arguments from attributes Fix commands when local vault is disabled [Lock] Fix incorrect return type in PostgreSqlStore
2 parents 1c79d80 + 580c9e6 commit 281c697

File tree

12 files changed

+118
-16
lines changed

12 files changed

+118
-16
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 🐛 Bug Report
2+
description: ⚠️ See below for security reports
3+
labels: Bug
4+
5+
body:
6+
- type: input
7+
id: affected-versions
8+
attributes:
9+
label: Symfony version(s) affected
10+
placeholder: x.y.z
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: description
15+
attributes:
16+
label: Description
17+
description: A clear and consise description of the problem
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: how-to-reproduce
22+
attributes:
23+
label: How to reproduce
24+
description: |
25+
Code and/or config needed to reproduce the problem.
26+
If it's a complex bug, create a "bug reproducer" as explained in https://symfony.com/doc/current/contributing/code/reproducer.html
27+
validations:
28+
required: true
29+
- type: textarea
30+
id: possible-solution
31+
attributes:
32+
label: Possible Solution
33+
description: "Optional: only if you have suggestions on a fix/reason for the bug"
34+
- type: textarea
35+
id: additional-context
36+
attributes:
37+
label: Additional Context
38+
description: "Optional: any other context about the problem: log messages, screenshots, etc."
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 🚀 Feature Request
2+
description: RFC and ideas for new features and improvements
3+
body:
4+
- type: textarea
5+
id: description
6+
attributes:
7+
label: Description
8+
description: A clear and concise description of the new feature
9+
validations:
10+
required: true
11+
- type: textarea
12+
id: example
13+
attributes:
14+
label: Example
15+
description: |
16+
A simple example of the new feature in action (include PHP code, YAML config, etc.)
17+
If the new feature changes an existing feature, include a simple before/after comparison.

src/Symfony/Bundle/FrameworkBundle/Resources/config/console.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@
307307
->set('console.command.secrets_list', SecretsListCommand::class)
308308
->args([
309309
service('secrets.vault'),
310-
service('secrets.local_vault'),
310+
service('secrets.local_vault')->ignoreOnInvalid(),
311311
])
312312
->tag('console.command')
313313

@@ -321,7 +321,7 @@
321321
->set('console.command.secrets_encrypt_from_local', SecretsEncryptFromLocalCommand::class)
322322
->args([
323323
service('secrets.vault'),
324-
service('secrets.local_vault'),
324+
service('secrets.local_vault')->ignoreOnInvalid(),
325325
])
326326
->tag('console.command')
327327
;

src/Symfony/Component/Console/Helper/QuestionHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ protected function formatChoiceQuestionChoices(ChoiceQuestion $question, string
208208
{
209209
$messages = [];
210210

211-
$maxWidth = max(array_map('self::width', array_keys($choices = $question->getChoices())));
211+
$maxWidth = max(array_map([__CLASS__, 'width'], array_keys($choices = $question->getChoices())));
212212

213213
foreach ($choices as $key => $value) {
214214
$padding = str_repeat(' ', $maxWidth - self::width($key));

src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,8 @@ private function autowireCalls(\ReflectionClass $reflectionClass, bool $isRoot,
163163
$this->decoratedClass = null;
164164
$this->getPreviousValue = null;
165165

166-
if ($isRoot && ($definition = $this->container->getDefinition($this->currentId)) && ($decoratedDefinition = $definition->getDecoratedService()) && null !== ($innerId = $decoratedDefinition[0]) && $this->container->has($innerId)) {
167-
// If the class references to itself and is decorated, provide the inner service id and class to not get a circular reference
168-
$this->decoratedClass = $this->container->findDefinition($innerId)->getClass();
169-
$this->decoratedId = $decoratedDefinition[1] ?? $this->currentId.'.inner';
166+
if ($isRoot && ($definition = $this->container->getDefinition($this->currentId)) && null !== ($this->decoratedId = $definition->innerServiceId) && $this->container->has($this->decoratedId)) {
167+
$this->decoratedClass = $this->container->findDefinition($this->decoratedId)->getClass();
170168
}
171169

172170
$patchedIndexes = [];

src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ public function __construct()
6262
new AutowireRequiredMethodsPass(),
6363
new AutowireRequiredPropertiesPass(),
6464
new ResolveBindingsPass(),
65+
new ServiceLocatorTagPass(),
66+
new DecoratorServicePass(),
6567
new CheckDefinitionValidityPass(),
6668
new AutowirePass(false),
6769
new ServiceLocatorTagPass(),
68-
new DecoratorServicePass(),
6970
new ResolveTaggedIteratorArgumentPass(),
7071
new ResolveServiceSubscribersPass(),
7172
new ResolveReferencesToAliasesPass(),

src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,8 +1027,8 @@ public function testAutowireDecorator()
10271027
->setAutowired(true)
10281028
;
10291029

1030-
(new AutowirePass())->process($container);
10311030
(new DecoratorServicePass())->process($container);
1031+
(new AutowirePass())->process($container);
10321032

10331033
$definition = $container->getDefinition(Decorator::class);
10341034
$this->assertSame(Decorator::class.'.inner', (string) $definition->getArgument(1));
@@ -1050,8 +1050,8 @@ public function testAutowireDecoratorChain()
10501050
->setAutowired(true)
10511051
;
10521052

1053-
(new AutowirePass())->process($container);
10541053
(new DecoratorServicePass())->process($container);
1054+
(new AutowirePass())->process($container);
10551055

10561056
$definition = $container->getDefinition(DecoratedDecorator::class);
10571057
$this->assertSame(DecoratedDecorator::class.'.inner', (string) $definition->getArgument(0));
@@ -1068,8 +1068,8 @@ public function testAutowireDecoratorRenamedId()
10681068
->setAutowired(true)
10691069
;
10701070

1071-
(new AutowirePass())->process($container);
10721071
(new DecoratorServicePass())->process($container);
1072+
(new AutowirePass())->process($container);
10731073

10741074
$definition = $container->getDefinition(Decorator::class);
10751075
$this->assertSame('renamed', (string) $definition->getArgument(1));
@@ -1086,11 +1086,12 @@ public function testDoNotAutowireDecoratorWhenSeveralArgumentOfTheType()
10861086
->setAutowired(true)
10871087
;
10881088

1089+
(new DecoratorServicePass())->process($container);
10891090
try {
10901091
(new AutowirePass())->process($container);
10911092
$this->fail('AutowirePass should have thrown an exception');
10921093
} catch (AutowiringFailedException $e) {
1093-
$this->assertSame('Cannot autowire service "Symfony\Component\DependencyInjection\Tests\Compiler\NonAutowirableDecorator": argument "$decorated1" of method "__construct()" references interface "Symfony\Component\DependencyInjection\Tests\Compiler\DecoratorInterface" but no such service exists. You should maybe alias this interface to one of these existing services: "Symfony\Component\DependencyInjection\Tests\Compiler\Decorated", "Symfony\Component\DependencyInjection\Tests\Compiler\NonAutowirableDecorator".', (string) $e->getMessage());
1094+
$this->assertSame('Cannot autowire service "Symfony\Component\DependencyInjection\Tests\Compiler\NonAutowirableDecorator": argument "$decorated1" of method "__construct()" references interface "Symfony\Component\DependencyInjection\Tests\Compiler\DecoratorInterface" but no such service exists. You should maybe alias this interface to one of these existing services: "Symfony\Component\DependencyInjection\Tests\Compiler\NonAutowirableDecorator", "Symfony\Component\DependencyInjection\Tests\Compiler\NonAutowirableDecorator.inner".', (string) $e->getMessage());
10941095
}
10951096
}
10961097

src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,33 @@ public function testCanDecorateServiceLocator()
186186
$this->assertSame($container->get('foo'), $container->get(DecoratedServiceLocator::class)->get('foo'));
187187
}
188188

189+
public function testAliasDecoratedService()
190+
{
191+
$container = new ContainerBuilder();
192+
193+
$container->register('service', ServiceLocator::class)
194+
->setPublic(true)
195+
->setArguments([[]])
196+
;
197+
$container->register('decorator', DecoratedServiceLocator::class)
198+
->setDecoratedService('service')
199+
->setAutowired(true)
200+
->setPublic(true)
201+
;
202+
$container->setAlias(ServiceLocator::class, 'decorator.inner')
203+
->setPublic(true)
204+
;
205+
$container->register('user_service', DecoratedServiceLocator::class)
206+
->setAutowired(true)
207+
;
208+
209+
$container->compile();
210+
211+
$this->assertInstanceOf(DecoratedServiceLocator::class, $container->get('service'));
212+
$this->assertInstanceOf(ServiceLocator::class, $container->get(ServiceLocator::class));
213+
$this->assertSame($container->get('service'), $container->get('decorator'));
214+
}
215+
189216
/**
190217
* @dataProvider getYamlCompileTests
191218
*/

src/Symfony/Component/Lock/Store/PostgreSqlStore.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Symfony\Component\Lock\Exception\InvalidArgumentException;
1818
use Symfony\Component\Lock\Exception\LockConflictedException;
1919
use Symfony\Component\Lock\Key;
20-
use Symfony\Component\Lock\PersistingStoreInterface;
20+
use Symfony\Component\Lock\SharedLockStoreInterface;
2121

2222
/**
2323
* PostgreSqlStore is a PersistingStoreInterface implementation using
@@ -302,7 +302,7 @@ private function checkDriver(): void
302302
}
303303
}
304304

305-
private function getInternalStore(): PersistingStoreInterface
305+
private function getInternalStore(): SharedLockStoreInterface
306306
{
307307
$namespace = spl_object_hash($this->getConnection());
308308

src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,18 @@
390390
<source>This value should be a valid expression.</source>
391391
<target>این مقدار باید یک عبارت معتبر باشد.</target>
392392
</trans-unit>
393+
<trans-unit id="101">
394+
<source>This value is not a valid CSS color.</source>
395+
<target>این مقدار یک رنگ معتبر در CSS نیست.</target>
396+
</trans-unit>
397+
<trans-unit id="102">
398+
<source>This value is not a valid CIDR notation.</source>
399+
<target>این مقدار یک نماد معتبر در CIDR نیست.</target>
400+
</trans-unit>
401+
<trans-unit id="103">
402+
<source>The value of the netmask should be between {{ min }} and {{ max }}.</source>
403+
<target>مقدار ماسک شبکه (NetMask) باید بین {{ min }} و {{ max }} باشد.</target>
404+
</trans-unit>
393405
</body>
394406
</file>
395407
</xliff>

src/Symfony/Component/Validator/Resources/translations/validators.id.xlf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,20 @@
388388
</trans-unit>
389389
<trans-unit id="100">
390390
<source>This value should be a valid expression.</source>
391-
<target>Nilai ini harus berupa ekspresi yang valid.</target>
391+
<target>Nilai ini harus berupa ekspresi yang sah.</target>
392392
</trans-unit>
393393
<trans-unit id="101">
394394
<source>This value is not a valid CSS color.</source>
395395
<target>Nilai ini bukan merupakan warna CSS yang sah.</target>
396396
</trans-unit>
397+
<trans-unit id="102">
398+
<source>This value is not a valid CIDR notation.</source>
399+
<target>Nilai ini bukan merupakan notasi CIDR yang sah.</target>
400+
</trans-unit>
401+
<trans-unit id="103">
402+
<source>The value of the netmask should be between {{ min }} and {{ max }}.</source>
403+
<target>Nilai dari netmask harus berada diantara {{ min }} dan {{ max }}.</target>
404+
</trans-unit>
397405
</body>
398406
</file>
399407
</xliff>

src/Symfony/Component/VarDumper/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ VarDumper Component
33

44
The VarDumper component provides mechanisms for walking through any arbitrary
55
PHP variable. It provides a better `dump()` function that you can use instead
6-
of `var_dump`.
6+
of `var_dump()`.
77

88
Resources
99
---------

0 commit comments

Comments
 (0)
0