Skip to content
This repository was archived by the owner on Mar 12, 2024. It is now read-only.

Commit 1de1e37

Browse files
committed
simplify the function
1 parent 0d2083b commit 1de1e37

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/Traits/WithLoopFunctions.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,11 @@ public function arrayToProperties(?array $data, mixed $rescue = null): void
4545
{
4646
collect($data ?? [])
4747
->except($this->ignoreKeys())
48-
->each(function ($value, $key) use ($rescue) {
49-
if (is_array($key)) {
50-
$this->arrayToProperties($key, $rescue);
51-
} else {
52-
$this->assignValue($key, $value, $rescue);
53-
}
54-
});
48+
->each(
49+
fn ($value, $key) => is_array($key)
50+
? $this->arrayToProperties($key, $rescue)
51+
: $this->assignValue($key, $value, $rescue)
52+
);
5553
}
5654

5755
/**

0 commit comments

Comments
 (0)