diff --git a/src/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php b/src/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php index db69a41b6..49a923cc3 100644 --- a/src/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php +++ b/src/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php @@ -213,7 +213,7 @@ private function getAnnotations(Context $parentContext, $reflection, ?array $val */ private function locateAnnotations($reflection): \Traversable { - if (\PHP_VERSION_ID >= 80000) { + if (\PHP_VERSION_ID >= 80000 && class_exists(Constraint::class)) { foreach ($reflection->getAttributes(Constraint::class, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) { yield $attribute->newInstance(); }