Skip to content

Commit 61c3022

Browse files
committed
Fixed case where void return types had no mapped response
1 parent a4619c1 commit 61c3022

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Annotations/AnnotationGenerator.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,9 @@ public function getOpenApiTypeFromPhpType(string $type): string
657657
case 'double':
658658
$type = 'number';
659659
break;
660+
case 'void':
661+
$type = 'null';
662+
break;
660663
default:
661664
$type = 'string';
662665
}
@@ -1081,7 +1084,7 @@ protected function determineResponses(array $rules, string $plugin, string $meth
10811084
}
10821085

10831086
// If it's a generic type and there's no custom description, use one of the global generic responses
1084-
if (empty($successArray['ref']) && !empty($responseInfo['type']) && empty($responseInfo['description'])) {
1087+
if (empty($successArray['ref']) && !empty($responseInfo['type']) && empty($responseInfo['description']->getBodyTemplate())) {
10851088
$ref = '';
10861089
switch ($responseInfo['type']) {
10871090
case 'array':
@@ -1096,6 +1099,8 @@ protected function determineResponses(array $rules, string $plugin, string $meth
10961099
case 'string':
10971100
$ref = '#/components/responses/GenericString';
10981101
break;
1102+
case 'null':
1103+
$ref = '#/components/responses/GenericSuccess';
10991104
}
11001105

11011106
if (!empty($ref)) {

0 commit comments

Comments
 (0)