Skip to content

Commit 060e4b1

Browse files
committed
feature #1030 [Agent][Platform] Make closures static where possible (OskarStark)
This PR was merged into the main branch. Discussion ---------- [Agent][Platform] Make closures static where possible | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Docs? | no | Issues | -- | License | MIT Commits ------- ad302ca Make closures static where possible
2 parents 0a51f57 + ad302ca commit 060e4b1

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/agent/src/Bridge/Youtube/YoutubeTranscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __invoke(string $videoId): string
4242
$list = $fetcher->fetch($videoId);
4343
$transcript = $list->findTranscript($list->getAvailableLanguageCodes());
4444

45-
return array_reduce($transcript->fetch(), function (string $carry, array $item): string {
45+
return array_reduce($transcript->fetch(), static function (string $carry, array $item): string {
4646
return $carry.\PHP_EOL.$item['text'];
4747
}, '');
4848
}

src/platform/src/Bridge/HuggingFace/Command/ModelListCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __invoke(
4747
return Command::FAILURE;
4848
}
4949

50-
$formatModel = function (Model $model) {
50+
$formatModel = static function (Model $model) {
5151
return \sprintf('%s <comment>[%s]</>', $model->getName(), implode(', ', $model->getOptions()['tags'] ?? []));
5252
};
5353

src/platform/src/Bridge/Ollama/Contract/AssistantMessageNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function normalize(mixed $data, ?string $format = null, array $context =
4747
return [
4848
'role' => Role::Assistant,
4949
'content' => $data->getContent() ?? '',
50-
'tool_calls' => array_values(array_map(function (ToolCall $message): array {
50+
'tool_calls' => array_values(array_map(static function (ToolCall $message): array {
5151
return [
5252
'type' => 'function',
5353
'function' => [

src/platform/tests/Result/StreamResultTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final class StreamResultTest extends TestCase
1818
{
1919
public function testGetContent()
2020
{
21-
$generator = (function () {
21+
$generator = (static function () {
2222
yield 'data1';
2323
yield 'data2';
2424
})();

0 commit comments

Comments
 (0)