From a83a10df1be98a678f83e75249d790fd98e47fed Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 28 Mar 2025 14:32:20 +0100 Subject: [PATCH 1/3] Bump Symfony version to 6.4.21 --- Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kernel.php b/Kernel.php index 49f3b698ac..dd80ab6175 100644 --- a/Kernel.php +++ b/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static array $freshCache = []; - public const VERSION = '6.4.20'; - public const VERSION_ID = 60420; + public const VERSION = '6.4.21-DEV'; + public const VERSION_ID = 60421; public const MAJOR_VERSION = 6; public const MINOR_VERSION = 4; - public const RELEASE_VERSION = 20; - public const EXTRA_VERSION = ''; + public const RELEASE_VERSION = 21; + public const EXTRA_VERSION = 'DEV'; public const END_OF_MAINTENANCE = '11/2026'; public const END_OF_LIFE = '11/2027'; From eade992bdf9017cf85fca5bb2404a0069ffab71c Mon Sep 17 00:00:00 2001 From: Ruud Kamphuis Date: Mon, 7 Apr 2025 11:34:28 +0200 Subject: [PATCH 2/3] Do not ignore enum when Autowire attribute in RegisterControllerArgumentLocatorsPass When moving services injected from the constructor to the controller arguments, I noticed a bug. We were auto wiring an env var to a backed enum like this: ```php class Foo { public function __construct( #[Autowire(env: 'enum:App\Enum:SOME_ENV_KEY')] private \App\Enum $someEnum, ) {} public function __invoke() {} } ``` This works fine with normal Symfony Dependency Injection. But when we switch to controller arguments like this: ```php class Foo { public function __invoke( #[Autowire(env: 'enum:App\Enum:SOME_ENV_KEY')] \App\Enum $someEnum, ) {} } ``` This stops working. The issue is that BackedEnum's are excluded. But this should only be excluded when there is no Autowire attribute. --- .../RegisterControllerArgumentLocatorsPass.php | 2 +- .../RegisterControllerArgumentLocatorsPassTest.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DependencyInjection/RegisterControllerArgumentLocatorsPass.php b/DependencyInjection/RegisterControllerArgumentLocatorsPass.php index 65bf1ef4c8..7d13c223a6 100644 --- a/DependencyInjection/RegisterControllerArgumentLocatorsPass.php +++ b/DependencyInjection/RegisterControllerArgumentLocatorsPass.php @@ -159,7 +159,7 @@ public function process(ContainerBuilder $container) continue; } elseif (!$autowire || (!($autowireAttributes ??= $p->getAttributes(Autowire::class, \ReflectionAttribute::IS_INSTANCEOF)) && (!$type || '\\' !== $target[0]))) { continue; - } elseif (is_subclass_of($type, \UnitEnum::class)) { + } elseif (!$autowireAttributes && is_subclass_of($type, \UnitEnum::class)) { // do not attempt to register enum typed arguments if not already present in bindings continue; } elseif (!$p->allowsNull()) { diff --git a/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php b/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php index d2927b16f4..0a8c488edc 100644 --- a/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php +++ b/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php @@ -498,13 +498,14 @@ public function testAutowireAttribute() $locator = $container->get($locatorId)->get('foo::fooAction'); - $this->assertCount(9, $locator->getProvidedServices()); + $this->assertCount(10, $locator->getProvidedServices()); $this->assertInstanceOf(\stdClass::class, $locator->get('service1')); $this->assertSame('foo/bar', $locator->get('value')); $this->assertSame('foo', $locator->get('expression')); $this->assertInstanceOf(\stdClass::class, $locator->get('serviceAsValue')); $this->assertInstanceOf(\stdClass::class, $locator->get('expressionAsValue')); $this->assertSame('bar', $locator->get('rawValue')); + $this->stringContains('Symfony_Component_HttpKernel_Tests_Fixtures_Suit_APP_SUIT', $locator->get('suit')); $this->assertSame('@bar', $locator->get('escapedRawValue')); $this->assertSame('foo', $locator->get('customAutowire')); $this->assertInstanceOf(FooInterface::class, $autowireCallable = $locator->get('autowireCallable')); @@ -719,6 +720,8 @@ public function fooAction( \stdClass $expressionAsValue, #[Autowire('bar')] string $rawValue, + #[Autowire(env: 'enum:\Symfony\Component\HttpKernel\Tests\Fixtures\Suit:APP_SUIT')] + Suit $suit, #[Autowire('@@bar')] string $escapedRawValue, #[CustomAutowire('some.parameter')] From 983ca05eec6623920d24ec0f1005f487d3734a0c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 2 May 2025 10:46:38 +0200 Subject: [PATCH 3/3] Update VERSION for 6.4.21 --- Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel.php b/Kernel.php index dd80ab6175..3ea14b47ed 100644 --- a/Kernel.php +++ b/Kernel.php @@ -76,12 +76,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static array $freshCache = []; - public const VERSION = '6.4.21-DEV'; + public const VERSION = '6.4.21'; public const VERSION_ID = 60421; public const MAJOR_VERSION = 6; public const MINOR_VERSION = 4; public const RELEASE_VERSION = 21; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '11/2026'; public const END_OF_LIFE = '11/2027';