-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Symfony version(s) affected
6.2.x-dev
Description
Hi!
Currently, the new _controller_reflectors in ControllerEvent - https://github.com/symfony/symfony/blob/6.2/src/Symfony/Component/HttpKernel/Event/ControllerEvent.php#L64-L66 - is causing the Route attribute to break.
From the MakerBundle test suite, while testing a normal [Route()] above a traditional controller action method:
Uncaught PHP Exception Error: "Attribute "Symfony\Component\Routing\Annotation\Route" cannot target function (allowed targets: class, method)" at /.../vendor/symfony/http-kernel/Event/ControllerEvent.php line 82
The problem seems to come from the ReflectionFunction... which seems to confuse the attributes system.
Cheers!
How to reproduce
In Symfony 6.2, create a #[Route] and then go to the page for that route.
Possible Solution
I'm not familiar with the implications of using ReflectionFunction vs ReflectionMethod, but it seems we need ReflectionMethod for the attributes to be instantiated correctly?
Additional Context
No response