diff --git a/src/Eloquent/Concerns/IsAranguentModel.php b/src/Eloquent/Concerns/IsAranguentModel.php index 37a63ee..15755ba 100644 --- a/src/Eloquent/Concerns/IsAranguentModel.php +++ b/src/Eloquent/Concerns/IsAranguentModel.php @@ -34,7 +34,9 @@ protected function insertAndSetId(IlluminateEloquentBuilder $query, $attributes) $matches = []; preg_match('/\/(.*)$/', $id, $matches); - $this->setAttribute('id', $matches[1]); + // We know the exact string format for $matches when the attribute is _id + /** @var array{0: string, 1: string} $matches */ + $this->setAttribute('id', $matches[1]); // @phpstan-ignore arrayUnpacking.stringOffset } if ($keyName === 'id' || $keyName === '_key') { $this->updateIdWithKey($id);