idea-php-symfony2-plugin
idea-php-symfony2-plugin copied to clipboard
#[Route] attribute on method cannot be found if preceded by another attribute
May or may not be related to #2176 ?
This does not work:
#[IsGranted('ROLE_ADMIN')]
#[Route(path: '/admin', name: 'admin', methods: ['GET', 'POST'])]
public function admin(Request $request): Response
This works:
#[Route(path: '/admin', name: 'admin', methods: ['GET', 'POST'])]
#[IsGranted('ROLE_ADMIN')]
public function admin(Request $request): Response
I am having the same issue (with PhpStorm 2024.1.2 and Symfony Support Plugin 2024.1.274), routes seem to be ignored/not found if the Route attribute is preceded by another attribute.
Excellent isolation of the problem. I have been trying to figure this out myself as well why some of my routes throw a "Symfony: Missing Routes" error when I check the code.