From d733b78f88dd508ed52cbb2e02a07dda3394aee5 Mon Sep 17 00:00:00 2001 From: robmro27 Date: Sat, 1 May 2021 14:19:42 +0200 Subject: [PATCH] [Routing] allow extending Route attribute --- .../Component/Routing/Loader/AnnotationClassLoader.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index 0b362ad1e0e04..a1bb35f09266f 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -280,7 +280,7 @@ protected function getGlobals(\ReflectionClass $class) $globals = $this->resetGlobals(); $annot = null; - if (\PHP_VERSION_ID >= 80000 && ($attribute = $class->getAttributes($this->routeAnnotationClass)[0] ?? null)) { + if (\PHP_VERSION_ID >= 80000 && ($attribute = $class->getAttributes($this->routeAnnotationClass, \ReflectionAttribute::IS_INSTANCEOF)[0] ?? null)) { $annot = $attribute->newInstance(); } if (!$annot && $this->reader) { @@ -372,7 +372,7 @@ abstract protected function configureRoute(Route $route, \ReflectionClass $class private function getAnnotations(object $reflection): iterable { if (\PHP_VERSION_ID >= 80000) { - foreach ($reflection->getAttributes($this->routeAnnotationClass) as $attribute) { + foreach ($reflection->getAttributes($this->routeAnnotationClass, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) { yield $attribute->newInstance(); } }