Fix undefined property $this->mediaType (#1633)

This commit is contained in:
Fabien Salathe 2020-05-29 18:53:58 +02:00 committed by GitHub
parent b2b0e60617
commit 3f90ef6ce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,7 +105,7 @@ final class ModelRegister
}
}
private function getGroups(ModelAnnotation $model, array $parentGroups = null)
private function getGroups(ModelAnnotation $model, array $parentGroups = null): ?array
{
if (null === $model->groups) {
return $parentGroups;
@ -114,7 +114,7 @@ final class ModelRegister
return array_merge($parentGroups ?? [], $model->groups);
}
private function detach(ModelAnnotation $model, OA\AbstractAnnotation $annotation, Analysis $analysis)
private function detach(ModelAnnotation $model, OA\AbstractAnnotation $annotation, Analysis $analysis): void
{
foreach ($annotation->_unmerged as $key => $unmerged) {
if ($unmerged === $model) {
@ -162,7 +162,7 @@ final class ModelRegister
break;
default:
throw new \InvalidArgumentException(sprintf("@Model annotation is not compatible with the media type '%s'. It must be one of 'json' or 'xml'.", $this->mediaType));
throw new \InvalidArgumentException(sprintf("@Model annotation is not compatible with the media types '%s'. It must be one of 'json' or 'xml'.", implode(',', $this->mediaTypes)));
}
$annotation->merge([$modelAnnotation]);