Skip to content

Commit 24f5163

Browse files
imorlandclaude
andauthored
fix: guard against null return from DataType::export() (#68)
The DataType contract declares export() as ?array, but the Exporter did not handle a null return — causing a PHP warning when iterating over it. Skip null returns instead of attempting to foreach them. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2f3db9d commit 24f5163

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Exporter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public function export(User $user, User $actor): Export
5757

5858
$data = $segment->export();
5959

60+
if ($data === null) {
61+
continue;
62+
}
63+
6064
// Check if the array is an indexed array of associative arrays
6165
if (is_array($data) && array_values($data) === $data) {
6266
// Handling list of associative arrays

0 commit comments

Comments
 (0)