Skip to content

Commit

Permalink
Improved support for SplFixedArray
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jul 28, 2024
1 parent 91a1bf7 commit 5a5e0ec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/laravel/SparseVector.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public function set(mixed $model, string $key, mixed $value, array $attributes):
return null;
}

if (is_array($value)) {
// TODO use !($value instanceof SparseVector) in 0.3.0
if (is_array($value) || $value instanceof \SplFixedArray) {
$value = new SparseVector($value);
}

Expand Down

0 comments on commit 5a5e0ec

Please sign in to comment.