diff --git a/src/DataCollection.php b/src/DataCollection.php index 6222b70b..1d5d533d 100644 --- a/src/DataCollection.php +++ b/src/DataCollection.php @@ -102,9 +102,9 @@ public function offsetGet($offset): mixed throw InvalidDataCollectionOperation::create(); } - $data = $this->items->offsetGet($offset); + $data = $this->items->offsetGet($offset); - if($data instanceof IncludeableDataContract){ + if($data instanceof IncludeableDataContract) { $data->withPartialTrees($this->getPartialTrees()); } diff --git a/tests/DataCollectionTest.php b/tests/DataCollectionTest.php index f2b0f24f..210522f4 100644 --- a/tests/DataCollectionTest.php +++ b/tests/DataCollectionTest.php @@ -10,13 +10,13 @@ use Spatie\LaravelData\DataCollection; use Spatie\LaravelData\PaginatedDataCollection; use Spatie\LaravelData\Support\PartialTrees; -use Spatie\LaravelData\Tests\Fakes\ComplicatedData; use Spatie\LaravelData\Tests\Fakes\DataCollections\CustomDataCollection; use Spatie\LaravelData\Tests\Fakes\DataCollections\CustomPaginatedDataCollection; use Spatie\LaravelData\Tests\Fakes\DefaultLazyData; use Spatie\LaravelData\Tests\Fakes\LazyData; use Spatie\LaravelData\Tests\Fakes\MultiData; use Spatie\LaravelData\Tests\Fakes\SimpleData; + use function Spatie\Snapshots\assertMatchesJsonSnapshot; use function Spatie\Snapshots\assertMatchesSnapshot; diff --git a/tests/DataTest.php b/tests/DataTest.php index 0ee2fe50..8fbbfe15 100644 --- a/tests/DataTest.php +++ b/tests/DataTest.php @@ -67,6 +67,7 @@ use Spatie\LaravelData\Tests\Fakes\UnionData; use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer; use Spatie\LaravelData\WithData; + use function Spatie\Snapshots\assertMatchesSnapshot; it('can create a resource', function () { @@ -2460,4 +2461,3 @@ public function __construct( yield 'no params' => [[], 'Could not create `Spatie\LaravelData\Tests\Fakes\MultiData`: the constructor requires 2 parameters, 0 given. Parameters missing: first, second.'], yield 'one param' => [['first' => 'First'], 'Could not create `Spatie\LaravelData\Tests\Fakes\MultiData`: the constructor requires 2 parameters, 1 given. Parameters given: first. Parameters missing: second.'], ]); - diff --git a/tests/Datasets/DataCollection.php b/tests/Datasets/DataCollection.php index 73c1be60..cfda0e26 100644 --- a/tests/Datasets/DataCollection.php +++ b/tests/Datasets/DataCollection.php @@ -2,7 +2,6 @@ use Spatie\LaravelData\Tests\Fakes\SimpleData; - dataset('collection-operations', function () { yield [ 'operation' => 'filter',