Merge pull request #1938 from magnetik/1937

Fixes symfony serializer being mandatory
This commit is contained in:
Guilhem Niot 2021-12-23 15:15:40 +01:00 committed by GitHub
commit cc6731ae77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -188,6 +188,9 @@ class ObjectModelDescriber implements ModelDescriberInterface, ModelRegistryAwar
*/ */
private function getAnnotation(\ReflectionClass $reflection, string $className) private function getAnnotation(\ReflectionClass $reflection, string $className)
{ {
if (false === class_exists($className)) {
return null;
}
if (\PHP_VERSION_ID >= 80000) { if (\PHP_VERSION_ID >= 80000) {
if (null !== $attribute = $reflection->getAttributes($className, \ReflectionAttribute::IS_INSTANCEOF)[0] ?? null) { if (null !== $attribute = $reflection->getAttributes($className, \ReflectionAttribute::IS_INSTANCEOF)[0] ?? null) {
return $attribute->newInstance(); return $attribute->newInstance();