diff --git a/Command/CacheClearCommand.php b/Command/CacheClearCommand.php index 40880df47..179f8e981 100644 --- a/Command/CacheClearCommand.php +++ b/Command/CacheClearCommand.php @@ -154,7 +154,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if ($this->isNfs($realBuildDir)) { - $io->note('For better performances, you should move the cache and log directories to a non-shared folder of the VM.'); + $io->note('For better performance, you should move the cache and log directories to a non-shared folder of the VM.'); $fs->remove($realBuildDir); } else { $fs->rename($realBuildDir, $oldBuildDir); diff --git a/Console/Descriptor/TextDescriptor.php b/Console/Descriptor/TextDescriptor.php index ebac3b370..cbffb5fcd 100644 --- a/Console/Descriptor/TextDescriptor.php +++ b/Console/Descriptor/TextDescriptor.php @@ -597,7 +597,7 @@ private function formatControllerLink(mixed $controller, string $anchorText, ?ca } elseif (!\is_string($controller)) { return $anchorText; } elseif (str_contains($controller, '::')) { - $r = new \ReflectionMethod($controller); + $r = new \ReflectionMethod(...explode('::', $controller, 2)); } else { $r = new \ReflectionFunction($controller); } diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index bb4f4cafc..6a006845f 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -2074,6 +2074,7 @@ private function addMailerSection(ArrayNodeDefinition $rootNode, callable $enabl ->end() ->arrayNode('envelope') ->info('Mailer Envelope configuration') + ->fixXmlConfig('recipient') ->children() ->scalarNode('sender')->end() ->arrayNode('recipients') diff --git a/Resources/config/schema/symfony-1.0.xsd b/Resources/config/schema/symfony-1.0.xsd index 57cc92334..2f70a3481 100644 --- a/Resources/config/schema/symfony-1.0.xsd +++ b/Resources/config/schema/symfony-1.0.xsd @@ -755,7 +755,7 @@ - + diff --git a/Resources/config/serializer.php b/Resources/config/serializer.php index 799cfb290..d46a92a02 100644 --- a/Resources/config/serializer.php +++ b/Resources/config/serializer.php @@ -212,6 +212,6 @@ ]) ->set('serializer.normalizer.backed_enum', BackedEnumNormalizer::class) - ->tag('serializer.normalizer', ['priority' => -915]) + ->tag('serializer.normalizer', ['priority' => -880]) ; }; diff --git a/Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php b/Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php index a707c0266..683872982 100644 --- a/Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php +++ b/Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php @@ -12,7 +12,7 @@ 'dsn' => 'smtp://example.com', 'envelope' => [ 'sender' => 'sender@example.org', - 'recipients' => ['redirected@example.org', 'redirected1@example.org'], + 'recipients' => ['redirected@example.org'], ], 'headers' => [ 'from' => 'from@example.org', diff --git a/Tests/DependencyInjection/Fixtures/xml/mailer_with_dsn.xml b/Tests/DependencyInjection/Fixtures/xml/mailer_with_dsn.xml index 02ecd32e7..3436cf417 100644 --- a/Tests/DependencyInjection/Fixtures/xml/mailer_with_dsn.xml +++ b/Tests/DependencyInjection/Fixtures/xml/mailer_with_dsn.xml @@ -12,8 +12,7 @@ sender@example.org - redirected@example.org - redirected1@example.org + redirected@example.org from@example.org bcc1@example.org diff --git a/Tests/DependencyInjection/Fixtures/xml/mailer_with_transports.xml b/Tests/DependencyInjection/Fixtures/xml/mailer_with_transports.xml index 650e6792d..1cd8523b6 100644 --- a/Tests/DependencyInjection/Fixtures/xml/mailer_with_transports.xml +++ b/Tests/DependencyInjection/Fixtures/xml/mailer_with_transports.xml @@ -14,8 +14,8 @@ smtp://example2.com sender@example.org - redirected@example.org - redirected1@example.org + redirected@example.org + redirected1@example.org from@example.org bcc1@example.org diff --git a/Tests/DependencyInjection/Fixtures/yml/mailer_with_dsn.yml b/Tests/DependencyInjection/Fixtures/yml/mailer_with_dsn.yml index e2793a9e7..e826d6bdc 100644 --- a/Tests/DependencyInjection/Fixtures/yml/mailer_with_dsn.yml +++ b/Tests/DependencyInjection/Fixtures/yml/mailer_with_dsn.yml @@ -10,7 +10,6 @@ framework: sender: sender@example.org recipients: - redirected@example.org - - redirected1@example.org headers: from: from@example.org bcc: [bcc1@example.org, bcc2@example.org] diff --git a/Tests/DependencyInjection/FrameworkExtensionTestCase.php b/Tests/DependencyInjection/FrameworkExtensionTestCase.php index bdda5134d..eede5ded3 100644 --- a/Tests/DependencyInjection/FrameworkExtensionTestCase.php +++ b/Tests/DependencyInjection/FrameworkExtensionTestCase.php @@ -355,7 +355,7 @@ public function testWorkflows() $this->assertSame('state_machine.pull_request.metadata_store', (string) $metadataStoreReference); $metadataStoreDefinition = $container->getDefinition('state_machine.pull_request.metadata_store'); - $this->assertSame(Workflow\Metadata\InMemoryMetadataStore::class, $metadataStoreDefinition->getClass()); + $this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass()); $this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass()); $workflowMetadata = $metadataStoreDefinition->getArgument(0); @@ -1989,21 +1989,27 @@ public function testHttpClientFullDefaultOptions() $this->assertSame(['foo' => ['bar' => 'baz']], $defaultOptions['extra']); } - public static function provideMailer(): array + public static function provideMailer(): iterable { - return [ - ['mailer_with_dsn', ['main' => 'smtp://example.com']], - ['mailer_with_transports', [ + yield [ + 'mailer_with_dsn', + ['main' => 'smtp://example.com'], + ['redirected@example.org'], + ]; + yield [ + 'mailer_with_transports', + [ 'transport1' => 'smtp://example1.com', 'transport2' => 'smtp://example2.com', - ]], + ], + ['redirected@example.org', 'redirected1@example.org'], ]; } /** * @dataProvider provideMailer */ - public function testMailer(string $configFile, array $expectedTransports) + public function testMailer(string $configFile, array $expectedTransports, array $expectedRecipients) { $container = $this->createContainerFromFile($configFile); @@ -2015,7 +2021,7 @@ public function testMailer(string $configFile, array $expectedTransports) $this->assertTrue($container->hasDefinition('mailer.envelope_listener')); $l = $container->getDefinition('mailer.envelope_listener'); $this->assertSame('sender@example.org', $l->getArgument(0)); - $this->assertSame(['redirected@example.org', 'redirected1@example.org'], $l->getArgument(1)); + $this->assertSame($expectedRecipients, $l->getArgument(1)); $this->assertEquals(new Reference('messenger.default_bus', ContainerInterface::NULL_ON_INVALID_REFERENCE), $container->getDefinition('mailer.mailer')->getArgument(1)); $this->assertTrue($container->hasDefinition('mailer.message_listener')); diff --git a/Tests/Fixtures/TranslatableBackedEnum.php b/Tests/Fixtures/TranslatableBackedEnum.php new file mode 100644 index 000000000..775276d84 --- /dev/null +++ b/Tests/Fixtures/TranslatableBackedEnum.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures; + +use Symfony\Contracts\Translation\TranslatableInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +enum TranslatableBackedEnum: string implements TranslatableInterface +{ + case Get = 'GET'; + + public function trans(TranslatorInterface $translator, ?string $locale = null): string + { + return match ($this) { + self::Get => 'custom_get_string', + }; + } +} diff --git a/Tests/Functional/SerializerTest.php b/Tests/Functional/SerializerTest.php index 630bfb7cd..2856816d1 100644 --- a/Tests/Functional/SerializerTest.php +++ b/Tests/Functional/SerializerTest.php @@ -11,6 +11,8 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; +use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\TranslatableBackedEnum; + /** * @author Kévin Dunglas */ @@ -67,6 +69,15 @@ public static function provideNormalizersAndEncodersWithDefaultContextOption(): ['serializer.encoder.csv.alias'], ]; } + + public function testSerializeTranslatableBackedEnum() + { + static::bootKernel(['test_case' => 'Serializer']); + + $serializer = static::getContainer()->get('serializer.alias'); + + $this->assertEquals('GET', $serializer->serialize(TranslatableBackedEnum::Get, 'yaml')); + } } class Foo