Skip to content

Commit ed9d056

Browse files
authored
Only look at attributes implementing Annotation
This make the code slight more efficient as it avoids instantiating unrelated attributes and also prevents crashes in case some attributes cannot be instantiated
1 parent a223567 commit ed9d056

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Config/Parser/AttributeParser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Overblog\GraphQLBundle\Config\Parser;
66

77
use Overblog\GraphQLBundle\Config\Parser\MetadataParser\MetadataParser;
8+
use Overblog\GraphQLBundle\Annotation\Annotation;
89
use ReflectionAttribute;
910
use ReflectionClass;
1011
use ReflectionClassConstant;
@@ -26,7 +27,7 @@ public static function getMetadatas(Reflector $reflector): array
2627
case $reflector instanceof ReflectionProperty:
2728
case $reflector instanceof ReflectionClassConstant:
2829
if (is_callable([$reflector, 'getAttributes'])) {
29-
$attributes = $reflector->getAttributes();
30+
$attributes = $reflector->getAttributes(Annotation::class, \ReflectionAttribute::IS_INSTANCEOF);
3031
}
3132
}
3233

0 commit comments

Comments
 (0)