Skip to content

Commit

Permalink
Allow for null values in list responsesAddresses #22 in v1 release se…
Browse files Browse the repository at this point in the history
…ries
  • Loading branch information
dcarbone committed Aug 6, 2021
1 parent 70bb4f2 commit f541ed8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Hydratable.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,17 +448,19 @@ private function hydrateArray(string $field, $value, array $def): void
foreach ($value as $k => $v) {
// todo: causes double-checking for null if value isn't null, not great...
if (null === $v) {
continue;
$this->{$field}[$k] = null;
} else {
$this->{$field}[$k] = $this->buildObjectValue($field, $v, $class, false);
}
$this->{$field}[$k] = $this->buildObjectValue($field, $v, $class, false);
}
} else {
// in all other cases, just set as-is
foreach ($value as $k => $v) {
if (null === $v) {
continue;
$this->{$field}[$k] = null;
} else {
$this->{$field}[$k] = $this->buildScalarValue($field, $v, $type, false);
}
$this->{$field}[$k] = $this->buildScalarValue($field, $v, $type, false);
}
}
}
Expand Down

0 comments on commit f541ed8

Please sign in to comment.