Skip to content

Commit

Permalink
Merge updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Dec 1, 2023
1 parent b57f99d commit 9a310d9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Resolvers/TransformedDataResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private function transform(BaseData&TransformableData $data, TransformationConte
return $payload;
}

if ($property->type->isOptional && ! isset($data->{$name})) {
if ($property->type->isOptional && ! array_key_exists($name, get_object_vars($data))) {
return $payload;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/DataCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
});

test('a collection can be rejected', function () {
$collection = SimpleData::collection(['A', 'B']);
$collection = new DataCollection(SimpleData::class, ['A', 'B']);

$filtered = $collection->reject(fn (SimpleData $data) => $data->string === 'B')->toArray();

Expand Down

0 comments on commit 9a310d9

Please sign in to comment.