Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions src/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,27 +139,24 @@ protected function doDeserializeProperty(OA\AbstractAnnotation $annotation, stri
// property is embedded annotation
// note: this does not support custom nested annotation classes
foreach ($annotation::$_nested as $nestedClass => $declaration) {
// property is an annotation
if (is_string($declaration) && $declaration === $property) {
if (is_object($value)) {
return $this->doDeserialize($value, $nestedClass, $context);
} else {
return $value;
if (is_string($declaration)) {
// property is an annotation
if ($declaration === $property) {
if (is_object($value)) {
return $this->doDeserialize($value, $nestedClass, $context);
} else {
return $value;
}
}
}

// property is an annotation array
if (is_array($declaration) && count($declaration) === 1 && $declaration[0] === $property) {
} elseif (count($declaration) === 1 && $declaration[0] === $property) {
// property is an annotation array
$annotationArr = [];
foreach ($value as $v) {
$annotationArr[] = $this->doDeserialize($v, $nestedClass, $context);
}

return $annotationArr;
}

// property is an annotation hash map
if (is_array($declaration) && count($declaration) === 2 && $declaration[0] === $property) {
} elseif (count($declaration) === 2 && $declaration[0] === $property) {
$key = $declaration[1];
$annotationHash = [];
foreach ($value as $k => $v) {
Expand Down
Loading