Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d733b78

Browse files
robmro27fabpot
authored andcommitted
[Routing] allow extending Route attribute
1 parent 0489ffc commit d733b78

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ protected function getGlobals(\ReflectionClass $class)
280280
$globals = $this->resetGlobals();
281281

282282
$annot = null;
283-
if (\PHP_VERSION_ID >= 80000 && ($attribute = $class->getAttributes($this->routeAnnotationClass)[0] ?? null)) {
283+
if (\PHP_VERSION_ID >= 80000 && ($attribute = $class->getAttributes($this->routeAnnotationClass, \ReflectionAttribute::IS_INSTANCEOF)[0] ?? null)) {
284284
$annot = $attribute->newInstance();
285285
}
286286
if (!$annot && $this->reader) {
@@ -372,7 +372,7 @@ abstract protected function configureRoute(Route $route, \ReflectionClass $class
372372
private function getAnnotations(object $reflection): iterable
373373
{
374374
if (\PHP_VERSION_ID >= 80000) {
375-
foreach ($reflection->getAttributes($this->routeAnnotationClass) as $attribute) {
375+
foreach ($reflection->getAttributes($this->routeAnnotationClass, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) {
376376
yield $attribute->newInstance();
377377
}
378378
}

0 commit comments

Comments
 (0)