Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 264c648

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: [Messenger] Fix merging PrototypedArrayNode associative values [Routing] Remove legacy group from Doctrine Annotations test Add missing entry to console upgrade log [mailer] Remove useless code [FrameworkBundle] Add autowiring alias for `HttpCache\StoreInterface`
2 parents 526144a + f27e6cc commit 264c648

File tree

9 files changed

+87
-51
lines changed

9 files changed

+87
-51
lines changed

UPGRADE-6.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Console
2424

2525
* `Command::setHidden()` has a default value (`true`) for `$hidden` parameter
2626
* Remove `Helper::strlen()`, use `Helper::width()` instead.
27+
* Remove `Helper::strlenWithoutDecoration()`, use `Helper::removeDecoration()` instead.
2728

2829
DependencyInjection
2930
-------------------

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"symfony/polyfill-intl-idn": "^1.10",
5151
"symfony/polyfill-intl-normalizer": "~1.0",
5252
"symfony/polyfill-mbstring": "~1.0",
53+
"symfony/polyfill-php81": "^1.22",
5354
"symfony/polyfill-uuid": "^1.15",
5455
"symfony/runtime": "self.version"
5556
},

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
5.4
5+
---
6+
7+
* Add autowiring alias for `HttpCache\StoreInterface`
8+
49
5.3
510
---
611

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter;
3535
use Symfony\Component\HttpKernel\EventListener\LocaleAwareListener;
3636
use Symfony\Component\HttpKernel\HttpCache\Store;
37+
use Symfony\Component\HttpKernel\HttpCache\StoreInterface;
3738
use Symfony\Component\HttpKernel\HttpKernel;
3839
use Symfony\Component\HttpKernel\HttpKernelInterface;
3940
use Symfony\Component\HttpKernel\KernelEvents;
@@ -104,6 +105,7 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : []
104105
->args([
105106
param('kernel.cache_dir').'/http_cache',
106107
])
108+
->alias(StoreInterface::class, 'http_cache.store')
107109

108110
->set('url_helper', UrlHelper::class)
109111
->args([

src/Symfony/Component/Config/Definition/PrototypedArrayNode.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ protected function normalizeValue($value)
215215

216216
$value = $this->remapXml($value);
217217

218-
$isAssoc = array_keys($value) !== range(0, \count($value) - 1);
218+
$isList = array_is_list($value);
219219
$normalized = [];
220220
foreach ($value as $k => $v) {
221221
if (null !== $this->keyAttribute && \is_array($v)) {
222-
if (!isset($v[$this->keyAttribute]) && \is_int($k) && !$isAssoc) {
222+
if (!isset($v[$this->keyAttribute]) && \is_int($k) && $isList) {
223223
$ex = new InvalidConfigurationException(sprintf('The attribute "%s" must be set for path "%s".', $this->keyAttribute, $this->getPath()));
224224
$ex->setPath($this->getPath());
225225

@@ -261,7 +261,7 @@ protected function normalizeValue($value)
261261
}
262262

263263
$prototype = $this->getPrototypeForChild($k);
264-
if (null !== $this->keyAttribute || $isAssoc) {
264+
if (null !== $this->keyAttribute || !$isList) {
265265
$normalized[$k] = $prototype->normalize($v);
266266
} else {
267267
$normalized[] = $prototype->normalize($v);
@@ -294,9 +294,10 @@ protected function mergeValues($leftSide, $rightSide)
294294
return $rightSide;
295295
}
296296

297+
$isList = array_is_list($rightSide);
297298
foreach ($rightSide as $k => $v) {
298-
// prototype, and key is irrelevant, append the element
299-
if (null === $this->keyAttribute) {
299+
// prototype, and key is irrelevant there are no named keys, append the element
300+
if (null === $this->keyAttribute && $isList) {
300301
$leftSide[] = $v;
301302
continue;
302303
}

src/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,56 @@ public function getDataForKeyRemovedLeftValueOnly()
338338
],
339339
];
340340
}
341+
342+
/**
343+
* @dataProvider getPrototypedArrayNodeDataToMerge
344+
*/
345+
public function testPrototypedArrayNodeMerge($left, $right, $expected)
346+
{
347+
$node = new PrototypedArrayNode('options');
348+
$node->setNormalizeKeys(false);
349+
$node->setPrototype(new VariableNode('value'));
350+
$node->setDefaultValue([]);
351+
352+
$result = $node->merge($left, $right);
353+
354+
self::assertSame($result, $expected);
355+
}
356+
357+
public function getPrototypedArrayNodeDataToMerge()
358+
{
359+
return [
360+
// data to merged is a plain array
361+
[
362+
['foo', 'bar'],
363+
['foo', 'baz', 'qux'],
364+
['foo', 'bar', 'foo', 'baz', 'qux'],
365+
],
366+
// data to be merged is an associative array
367+
[
368+
['option1' => true, 'option2' => 'foo'],
369+
[
370+
'option2' => 'bar',
371+
'option3' => 42,
372+
'option4' => [
373+
'option41' => 'baz',
374+
'option42' => [
375+
'option423' => 'qux',
376+
],
377+
],
378+
],
379+
[
380+
'option1' => true,
381+
'option2' => 'bar',
382+
'option3' => 42,
383+
'option4' => [
384+
'option41' => 'baz',
385+
'option42' => [
386+
'option423' => 'qux',
387+
],
388+
],
389+
],
390+
],
391+
];
392+
}
341393
}

src/Symfony/Component/Config/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"php": ">=8.0.2",
2020
"symfony/deprecation-contracts": "^2.1",
2121
"symfony/filesystem": "^5.4|^6.0",
22-
"symfony/polyfill-ctype": "~1.8"
22+
"symfony/polyfill-ctype": "~1.8",
23+
"symfony/polyfill-php81": "^1.22"
2324
},
2425
"require-dev": {
2526
"symfony/event-dispatcher": "^5.4|^6.0",

src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesTransportFactory.php

Lines changed: 16 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
use AsyncAws\Core\Configuration;
1515
use AsyncAws\Ses\SesClient;
16-
use Symfony\Component\HttpClient\HttpClient;
17-
use Symfony\Component\Mailer\Exception\LogicException;
1816
use Symfony\Component\Mailer\Exception\UnsupportedSchemeException;
1917
use Symfony\Component\Mailer\Transport\AbstractTransportFactory;
2018
use Symfony\Component\Mailer\Transport\Dsn;
@@ -35,46 +33,22 @@ public function create(Dsn $dsn): TransportInterface
3533
return new SesSmtpTransport($this->getUser($dsn), $this->getPassword($dsn), $region, $this->dispatcher, $this->logger);
3634
}
3735

38-
if (!class_exists(SesClient::class)) {
39-
if (!class_exists(HttpClient::class)) {
40-
throw new \LogicException(sprintf('You cannot use "%s" as the HttpClient component or AsyncAws package is not installed. Try running "composer require async-aws/ses".', __CLASS__));
41-
}
42-
43-
trigger_deprecation('symfony/amazon-mailer', '5.1', 'Using the "%s" transport without AsyncAws is deprecated. Try running "composer require async-aws/ses".', $scheme, static::class);
44-
45-
$user = $this->getUser($dsn);
46-
$password = $this->getPassword($dsn);
47-
$host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
48-
$port = $dsn->getPort();
49-
50-
if ('ses+api' === $scheme) {
51-
if (!\extension_loaded('simplexml')) {
52-
throw new LogicException(sprintf('Cannot use "%s". Make sure you have "ext-simplexml" installed and enabled.', SesApiTransport::class));
53-
}
54-
55-
return (new SesApiTransport($user, $password, $region, $this->client, $this->dispatcher, $this->logger))->setHost($host)->setPort($port);
56-
}
57-
if ('ses+https' === $scheme || 'ses' === $scheme) {
58-
return (new SesHttpTransport($user, $password, $region, $this->client, $this->dispatcher, $this->logger))->setHost($host)->setPort($port);
59-
}
60-
} else {
61-
switch ($scheme) {
62-
case 'ses+api':
63-
$class = SesApiAsyncAwsTransport::class;
64-
// no break
65-
case 'ses':
66-
case 'ses+https':
67-
$class = $class ?? SesHttpAsyncAwsTransport::class;
68-
$options = [
69-
'region' => $dsn->getOption('region') ?: 'eu-west-1',
70-
'accessKeyId' => $dsn->getUser(),
71-
'accessKeySecret' => $dsn->getPassword(),
72-
] + (
73-
'default' === $dsn->getHost() ? [] : ['endpoint' => 'https://'.$dsn->getHost().($dsn->getPort() ? ':'.$dsn->getPort() : '')]
74-
);
75-
76-
return new $class(new SesClient(Configuration::create($options), null, $this->client, $this->logger), $this->dispatcher, $this->logger);
77-
}
36+
switch ($scheme) {
37+
case 'ses+api':
38+
$class = SesApiAsyncAwsTransport::class;
39+
// no break
40+
case 'ses':
41+
case 'ses+https':
42+
$class = $class ?? SesHttpAsyncAwsTransport::class;
43+
$options = [
44+
'region' => $dsn->getOption('region') ?: 'eu-west-1',
45+
'accessKeyId' => $dsn->getUser(),
46+
'accessKeySecret' => $dsn->getPassword(),
47+
] + (
48+
'default' === $dsn->getHost() ? [] : ['endpoint' => 'https://'.$dsn->getHost().($dsn->getPort() ? ':'.$dsn->getPort() : '')]
49+
);
50+
51+
return new $class(new SesClient(Configuration::create($options), null, $this->client, $this->logger), $this->dispatcher, $this->logger);
7852
}
7953

8054
throw new UnsupportedSchemeException($dsn, 'ses', $this->getSupportedSchemes());

src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,16 @@ public function testDeprecationArrayAsFirstArgument(string $parameter, $value, s
7474
* @requires PHP 8
7575
* @dataProvider getValidParameters
7676
*/
77-
public function testRouteParameters(string $methodName, string $getter, $expectedReturn)
77+
public function testLoadFromAttribute(string $methodName, string $getter, $expectedReturn)
7878
{
7979
$route = $this->getMethodAnnotation($methodName, true);
8080
$this->assertEquals($route->$getter(), $expectedReturn);
8181
}
8282

8383
/**
84-
* @group legacy
8584
* @dataProvider getValidParameters
8685
*/
87-
public function testLegacyRouteParameters(string $methodName, string $getter, $expectedReturn)
86+
public function testLoadFromDoctrineAnnotation(string $methodName, string $getter, $expectedReturn)
8887
{
8988
$route = $this->getMethodAnnotation($methodName, false);
9089
$this->assertEquals($route->$getter(), $expectedReturn);

0 commit comments

Comments
 (0)