[Routing] allow extending Route attribute
This commit is contained in:
parent
0489ffcaed
commit
d733b78f88
@ -280,7 +280,7 @@ abstract class AnnotationClassLoader implements LoaderInterface
|
|||||||
$globals = $this->resetGlobals();
|
$globals = $this->resetGlobals();
|
||||||
|
|
||||||
$annot = null;
|
$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();
|
$annot = $attribute->newInstance();
|
||||||
}
|
}
|
||||||
if (!$annot && $this->reader) {
|
if (!$annot && $this->reader) {
|
||||||
@ -372,7 +372,7 @@ abstract class AnnotationClassLoader implements LoaderInterface
|
|||||||
private function getAnnotations(object $reflection): iterable
|
private function getAnnotations(object $reflection): iterable
|
||||||
{
|
{
|
||||||
if (\PHP_VERSION_ID >= 80000) {
|
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();
|
yield $attribute->newInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user