Skip to content

Commit 31157c0

Browse files
committed
let early return return the expected data
1 parent c115516 commit 31157c0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Relations/EmbedsOneOrMany.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,21 +269,21 @@ protected function toCollection(array $records = [])
269269
/**
270270
* Create a related model instanced.
271271
*
272-
* @param array $attributes
272+
* @param mixed $attributes
273273
*
274-
* @return Model
274+
* @return Model | null
275275
*/
276-
protected function toModel($attributes = [])
276+
protected function toModel(mixed $attributes = []): Model|null
277277
{
278278
if ($attributes === null) {
279-
return;
279+
return null;
280280
}
281281

282282
$connection = $this->related->getConnection();
283283

284284
$model = $this->related->newFromBuilder(
285285
(array) $attributes,
286-
$connection ? $connection->getName() : null,
286+
$connection?->getName(),
287287
);
288288

289289
$model->setParentRelation($this);

0 commit comments

Comments
 (0)