Skip to content

Commit 38fc6f0

Browse files
authored
feat/set-sane-value-default Updated src/DataModel.php. (#49)
1 parent 62272be commit 38fc6f0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/DataModel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,14 @@ public static function from(array|object|null|string $context = [], mixed $insta
229229

230230
/** Property-level Pre Hook */
231231
if (isset($Describe->pre)) {
232-
($Describe->pre)($context[$context_key] ?? [], $context, $Attribute, $ReflectionProperty);
232+
($Describe->pre)($context[$context_key] ?? null, $context, $Attribute, $ReflectionProperty);
233233
}
234234

235235
$property_name = $ReflectionProperty->getName();
236236

237237
if (isset($Describe->default) && !isset($context[$context_key])) {
238238
$self->{$property_name} = is_callable($Describe->default)
239-
? ($Describe->default)([], $context, $Attribute, $ReflectionProperty)
239+
? ($Describe->default)(null, $context, $Attribute, $ReflectionProperty)
240240
: $Describe->default;
241241

242242
if (isset($Describe->post)) {
@@ -248,7 +248,7 @@ public static function from(array|object|null|string $context = [], mixed $insta
248248

249249
/** Property-level Cast */
250250
if (isset($Describe->cast)) {
251-
$self->{$property_name} = ($Describe->cast)($context[$context_key] ?? [], $context, $Attribute, $ReflectionProperty);
251+
$self->{$property_name} = ($Describe->cast)($context[$context_key] ?? null, $context, $Attribute, $ReflectionProperty);
252252

253253
/** Property-level Post Hook */
254254
if (isset($Describe->post)) {

0 commit comments

Comments
 (0)