Skip to content

Commit

Permalink
Simplify normalization of null (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
inxilpro authored May 30, 2024
1 parent b7390c2 commit c3687a3
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,8 @@ class_basename(static::class)
foreach (Arr::except($data, ['fqcn']) as $key => $value) {
$property = $reflect->getProperty($key);

if ($property->hasType() && ! $property->getType()->isBuiltin()) {
$is_nullable_with_null_value = $property->getType()->allowsNull()
&& $value === null;

$value = $is_nullable_with_null_value
? null
: $denormalizer->denormalize($value, $property->getType()->getName());
if ($property->hasType() && ! $property->getType()->isBuiltin() && $value !== null) {
$value = $denormalizer->denormalize($value, $property->getType()->getName());
}

$property->setValue($instance, $value);
Expand Down

0 comments on commit c3687a3

Please sign in to comment.