Skip to content

Commit

Permalink
Fix bool default in DataModel.php.
Browse files Browse the repository at this point in the history
  • Loading branch information
david_smith committed Oct 24, 2024
1 parent 9bcd5bc commit 0723743
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/DataModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,14 @@ public static function from(iterable|object|null $context = []): self

/** When a property name does not match a key name */
if (!array_key_exists($context_key, $context)) {
if ($Describe->default ?? false) {
if (isset($Describe->default)) {
$self->{$property_name} = $Describe->default;
continue;
}
if ($Describe->required ?? false) {
if (isset($Describe->required) && $Describe->required) {
throw new PropertyRequiredException("Property: $property_name is required");
}
if (($ClassDescribe->missing_as_null ?? false) || ($Describe->missing_as_null ?? false)) {
if (isset($ClassDescribe->missing_as_null) && $ClassDescribe?->missing_as_null) {
$self->{$property_name} = null;
continue;
}
Expand Down

0 comments on commit 0723743

Please sign in to comment.