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

Commit 8e42e59

Browse files
committed
inline nullsafe
1 parent 99e9d69 commit 8e42e59

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/Traits/LoopFunctions.php

+8-10
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@ trait LoopFunctions
2020
*/
2121
public function attributesToProperties(?Model $model = null, mixed $rescue = null): void
2222
{
23-
if (! is_null($model)) {
24-
collect($model->getAttributes())
25-
->except($this->ignoreKeys())
26-
->each(
27-
fn ($value, $property) => $this->assignValue(
28-
$property,
29-
$model->{$property}
30-
)
31-
);
32-
}
23+
collect($model?->getAttributes())
24+
->except($this->ignoreKeys())
25+
->each(
26+
fn ($value, $property) => $this->assignValue(
27+
$property,
28+
$model->{$property}
29+
)
30+
);
3331
}
3432

3533
/**

0 commit comments

Comments
 (0)