Skip to content

Commit d5da6c9

Browse files
CopilotOskarStark
andcommitted
Simplify content type check for better maintainability
Co-authored-by: OskarStark <995707+OskarStark@users.noreply.github.com>
1 parent edbdfdd commit d5da6c9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/agent/src/Toolbox/StreamResult.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ public function getContent(): \Generator
3939
}
4040

4141
$content = $innerResult->getContent();
42-
if ($content instanceof \Generator || $content instanceof \Iterator || (is_array($content))) {
43-
yield from $content;
44-
} else {
42+
// Strings are iterable in PHP but should be yielded as single values
43+
// null should also be yielded as-is
44+
if (is_string($content) || null === $content) {
4545
yield $content;
46+
} else {
47+
yield from $content;
4648
}
4749

4850
break;

0 commit comments

Comments
 (0)