Skip to content

Commit

Permalink
Infer array type name properly
Browse files Browse the repository at this point in the history
  • Loading branch information
shalvah committed Sep 23, 2021
1 parent 093a1f2 commit 7457dcc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Extracting/ParamHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ protected function normalizeTypeName(?string $typeName, $value = null): string
case 'bool':
return str_replace($base, 'boolean', $typeName);
case 'array':
return is_null($value) || array_keys($value)[0] === 0 ? 'array' : 'object';
if (empty($value) || array_keys($value)[0] === 0) {
return $this->normalizeTypeName(gettype($value[0] ?? '')).'[]';
} else {
return 'object';
}
default:
return $typeName;
}
Expand Down

0 comments on commit 7457dcc

Please sign in to comment.