diff --git a/src/Symfony/Component/Routing/Attribute/Route.php b/src/Symfony/Component/Routing/Attribute/Route.php index 0077f76db67bd..398a4dd70d9b4 100644 --- a/src/Symfony/Component/Routing/Attribute/Route.php +++ b/src/Symfony/Component/Routing/Attribute/Route.php @@ -20,8 +20,6 @@ * * @author Fabien Potencier * @author Alexander M. Turek - * - * @final since Symfony 6.4 */ #[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)] class Route diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/ExtendedRoute.php b/src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/ExtendedRoute.php new file mode 100644 index 0000000000000..55a44a814a5ea --- /dev/null +++ b/src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/ExtendedRoute.php @@ -0,0 +1,13 @@ +}" . $path, $name, [], [], array_merge(['section' => 'foo'], $defaults)); + } +} diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/ExtendedRouteOnClassController.php b/src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/ExtendedRouteOnClassController.php new file mode 100644 index 0000000000000..29ec190f8b5d9 --- /dev/null +++ b/src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/ExtendedRouteOnClassController.php @@ -0,0 +1,14 @@ +assertSame(['https'], $routes->get('string')->getSchemes()); } + public function testLoadingExtendedRouteOnClass() + { + $routes = $this->loader->load(ExtendedRouteOnClassController::class); + $this->assertCount(1, $routes); + $this->assertSame('/{section}/class-level/method-level', $routes->get('action')->getPath()); + $this->assertSame(['section' => 'foo'], $routes->get('action')->getDefaults()); + } + + public function testLoadingExtendedRouteOnMethod() + { + $routes = $this->loader->load(ExtendedRouteOnMethodController::class); + $this->assertCount(1, $routes); + $this->assertSame('/{section}/method-level', $routes->get('action')->getPath()); + $this->assertSame(['section' => 'foo'], $routes->get('action')->getDefaults()); + } + abstract protected function getNamespace(): string; }