mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Update parser to convert empty array defaults to null
Don't let empty arrays get passed through as defaults.
This commit is contained in:
parent
6bcd5e8d81
commit
37ae52ba0a
@ -115,7 +115,13 @@ class JmsMetadataParser implements ParserInterface, PostParserInterface
|
|||||||
$params = array();
|
$params = array();
|
||||||
|
|
||||||
$reflection = new \ReflectionClass($className);
|
$reflection = new \ReflectionClass($className);
|
||||||
$defaultProperties = $reflection->getDefaultProperties();
|
$defaultProperties = array_map(function ($default) {
|
||||||
|
if (is_array($default) && count($default) === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $default;
|
||||||
|
}, $reflection->getDefaultProperties());
|
||||||
|
|
||||||
// iterate over property metadata
|
// iterate over property metadata
|
||||||
foreach ($meta->propertyMetadata as $item) {
|
foreach ($meta->propertyMetadata as $item) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user