Skip to content

Commit 807317c

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: (40 commits) [PropertyInfo] treat mixed[] the same as array when getting types from docblocks treat `mixed[]` the same as `array` when getting types from docblocks install ext-zstd on PHP 8.5 as well fix merge [Console] Fix profile invokable command sync ControllerHelper docblock with latest AbstractController changes fix: Typehint for `createForm` in abstractController [Notifier][Mercure] Add support for Mercure 0.7 register attribute loader arguments in a forward-compatible way ensure compatibility with RelayCluster 0.20.0 mark test using a Redis connection as an integration test ensure compatibility with Relay extension 0.20.0 [FrameworkBundle] Allow backed enum to be used in initial_marking workflow configuration [DependencyInjection] Fix `query_string` env processor for URLs without query string [HttpFoundation] Fix Expires response header for EventStream Bump Symfony version to 7.4.1 Update VERSION for 7.4.0 Update CHANGELOG for 7.4.0 - [DependencyInjection] Fix state corruption in PhpFileLoader during recursive imports ...
2 parents 01cdaf3 + 72ec8e4 commit 807317c

File tree

11 files changed

+102
-4
lines changed

11 files changed

+102
-4
lines changed

Command/ConfigDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private function getConfigForPath(array $config, string $path, string $alias): m
161161
$steps = explode('.', $path);
162162

163163
foreach ($steps as $step) {
164-
if (!\array_key_exists($step, $config)) {
164+
if (!\is_array($config) || !\array_key_exists($step, $config)) {
165165
throw new LogicException(\sprintf('Unable to find configuration for "%s.%s".', $alias, $path));
166166
}
167167

Controller/AbstractController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
1818
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;
1919
use Symfony\Component\Form\Extension\Core\Type\FormType;
20+
use Symfony\Component\Form\Flow\FormFlowInterface;
21+
use Symfony\Component\Form\Flow\FormFlowTypeInterface;
2022
use Symfony\Component\Form\FormBuilderInterface;
2123
use Symfony\Component\Form\FormFactoryInterface;
2224
use Symfony\Component\Form\FormInterface;
@@ -344,6 +346,8 @@ protected function createAccessDeniedException(string $message = 'Access Denied.
344346

345347
/**
346348
* Creates and returns a Form instance from the type of the form.
349+
*
350+
* @return ($type is class-string<FormFlowTypeInterface> ? FormFlowInterface : FormInterface)
347351
*/
348352
protected function createForm(string $type, mixed $data = null, array $options = []): FormInterface
349353
{

Controller/ControllerHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
1818
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;
1919
use Symfony\Component\Form\Extension\Core\Type\FormType;
20+
use Symfony\Component\Form\Flow\FormFlowInterface;
21+
use Symfony\Component\Form\Flow\FormFlowTypeInterface;
2022
use Symfony\Component\Form\FormBuilderInterface;
2123
use Symfony\Component\Form\FormFactoryInterface;
2224
use Symfony\Component\Form\FormInterface;
@@ -337,6 +339,8 @@ public function createAccessDeniedException(string $message = 'Access Denied.',
337339

338340
/**
339341
* Creates and returns a Form instance from the type of the form.
342+
*
343+
* @return ($type is class-string<FormFlowTypeInterface> ? FormFlowInterface : FormInterface)
340344
*/
341345
public function createForm(string $type, mixed $data = null, array $options = []): FormInterface
342346
{

DependencyInjection/Configuration.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,19 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
462462
->cannotBeEmpty()
463463
->end()
464464
->arrayNode('initial_marking')
465-
->acceptAndWrap(['string'])
465+
->acceptAndWrap(['backed-enum', 'string'])
466466
->defaultValue([])
467+
->beforeNormalization()
468+
->ifArray()
469+
->then(static function ($markings) {
470+
$normalizedMarkings = [];
471+
foreach ($markings as $marking) {
472+
$normalizedMarkings[] = $marking instanceof \BackedEnum ? $marking->value : $marking;
473+
}
474+
475+
return $normalizedMarkings;
476+
})
477+
->end()
467478
->prototype('scalar')->end()
468479
->end()
469480
->arrayNode('events_to_dispatch', 'event_to_dispatch')
@@ -1936,6 +1947,7 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode, callable $e
19361947
->end()
19371948
->arrayNode('vars', 'var')
19381949
->info('Associative array: the default vars used to expand the templated URI.')
1950+
->useAttributeAsKey('name')
19391951
->normalizeKeys(false)
19401952
->variablePrototype()->end()
19411953
->end()
@@ -2014,6 +2026,7 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode, callable $e
20142026
->end()
20152027
->arrayNode('extra')
20162028
->info('Extra options for specific HTTP client.')
2029+
->useAttributeAsKey('name')
20172030
->normalizeKeys(false)
20182031
->variablePrototype()->end()
20192032
->end()
@@ -2160,6 +2173,7 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode, callable $e
21602173
->end()
21612174
->arrayNode('extra')
21622175
->info('Extra options for specific HTTP client.')
2176+
->useAttributeAsKey('name')
21632177
->normalizeKeys(false)
21642178
->variablePrototype()->end()
21652179
->end()

DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,11 +1692,11 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
16921692

16931693
foreach ($config['providers'] as $provider) {
16941694
if ($provider['locales']) {
1695-
$locales += $provider['locales'];
1695+
$locales = array_merge($locales, $provider['locales']);
16961696
}
16971697
}
16981698

1699-
$locales = array_unique($locales);
1699+
$locales = array_values(array_unique($locales));
17001700

17011701
$container->getDefinition('console.command.translation_pull')
17021702
->replaceArgument(4, array_merge($transPaths, [$config['default_path']]))

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ public function testWorkflowEnumArcsNormalization()
632632
'enum' => [
633633
'supports' => [self::class],
634634
'places' => Places::cases(),
635+
'initial_marking' => Places::A,
635636
'transitions' => [
636637
[
637638
'name' => 'one',
@@ -649,6 +650,8 @@ public function testWorkflowEnumArcsNormalization()
649650
],
650651
]]);
651652

653+
$this->assertSame(['a'], $config['workflows']['workflows']['enum']['initial_marking']);
654+
652655
$transitions = $config['workflows']['workflows']['enum']['transitions'];
653656

654657
$this->assertSame('one', $transitions[0]['name']);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'annotations' => false,
5+
'http_method_override' => false,
6+
'handle_all_throwables' => true,
7+
'php_errors' => ['log' => true],
8+
'enabled_locales' => ['es'],
9+
'translator' => [
10+
'providers' => [
11+
'foo_provider' => [
12+
'locales' => ['en', 'fr'],
13+
],
14+
'bar_provider' => [
15+
'locales' => ['de', 'pl'],
16+
]
17+
]
18+
],
19+
]);
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:framework="http://symfony.com/schema/dic/symfony"
6+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
7+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
8+
9+
<framework:config secret="s3cr3t" http-method-override="false" handle-all-throwables="true">
10+
<framework:annotations enabled="false" />
11+
<framework:php-errors log="true" />
12+
<framework:enabled-locale>es</framework:enabled-locale>
13+
<framework:translator enabled="true">
14+
<framework:provider name="foo_provider">
15+
<framework:locale>en</framework:locale>
16+
<framework:locale>fr</framework:locale>
17+
</framework:provider>
18+
<framework:provider name="bar_provider">
19+
<framework:locale>de</framework:locale>
20+
<framework:locale>pl</framework:locale>
21+
</framework:provider>
22+
</framework:translator>
23+
</framework:config>
24+
</container>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
framework:
2+
annotations: false
3+
http_method_override: false
4+
handle_all_throwables: true
5+
enabled_locales: [ 'es' ]
6+
php_errors:
7+
log: true
8+
translator:
9+
providers:
10+
foo_provider:
11+
locales: [ 'en', 'fr' ]
12+
bar_provider:
13+
locales: [ 'de', 'pl' ]

Tests/DependencyInjection/FrameworkExtensionTestCase.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,13 @@ public function testTranslator()
13941394
$this->assertSame('Fixtures/translations', $options['cache_vary']['scanned_directories'][3]);
13951395
}
13961396

1397+
public function testTranslatorProvidersMergedEnabledLocales()
1398+
{
1399+
$container = $this->createContainerFromFile('translator_providers');
1400+
self::assertSame(['es', 'en', 'fr', 'de', 'pl'], $container->getDefinition('console.command.translation_pull')->getArgument(5));
1401+
self::assertSame(['es', 'en', 'fr', 'de', 'pl'], $container->getDefinition('console.command.translation_push')->getArgument(3));
1402+
}
1403+
13971404
public function testTranslatorMultipleFallbacks()
13981405
{
13991406
$container = $this->createContainerFromFile('translator_fallbacks');

0 commit comments

Comments
 (0)