From 3f90ef6ce94c5309c47b8af3759c9f2cb629cf1a Mon Sep 17 00:00:00 2001 From: Fabien Salathe Date: Fri, 29 May 2020 18:53:58 +0200 Subject: [PATCH] Fix undefined property `$this->mediaType` (#1633) --- OpenApiPhp/ModelRegister.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenApiPhp/ModelRegister.php b/OpenApiPhp/ModelRegister.php index 52c9903..bef46c9 100644 --- a/OpenApiPhp/ModelRegister.php +++ b/OpenApiPhp/ModelRegister.php @@ -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]);