Skip to content

Commit 3cc2ea5

Browse files
committed
[Platform] Add PHPStan array type annotations to bridge tests
1 parent d7e6105 commit 3cc2ea5

File tree

7 files changed

+28
-4
lines changed

7 files changed

+28
-4
lines changed

src/platform/src/Bridge/Gemini/Tests/Contract/ToolNormalizerTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public function testGetSupportedTypes()
4444
$this->assertSame($expected, $normalizer->getSupportedTypes(null));
4545
}
4646

47+
/**
48+
* @param array<string, mixed> $expected
49+
*/
4750
#[DataProvider('normalizeDataProvider')]
4851
public function testNormalize(Tool $tool, array $expected)
4952
{
@@ -55,7 +58,7 @@ public function testNormalize(Tool $tool, array $expected)
5558
}
5659

5760
/**
58-
* @return iterable<array{0: Tool, 1: array}>
61+
* @return iterable<array{0: Tool, 1: array<string, mixed>}>
5962
*/
6063
public static function normalizeDataProvider(): iterable
6164
{

src/platform/src/Bridge/Gemini/Tests/TokenOutputProcessorTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ public function testItHandlesMissingUsageFields()
130130
$this->assertNull($tokenUsage->totalTokens);
131131
}
132132

133+
/**
134+
* @param array<string, mixed> $data
135+
*/
133136
private function createRawResult(array $data = []): RawHttpResult
134137
{
135138
$rawResponse = $this->createStub(ResponseInterface::class);

src/platform/src/Bridge/HuggingFace/Tests/Contract/FileNormalizerTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ public function testGetSupportedTypes()
4141
$this->assertSame($expected, $normalizer->getSupportedTypes(null));
4242
}
4343

44+
/**
45+
* @param array<string, mixed> $expected
46+
*/
4447
#[DataProvider('normalizeDataProvider')]
4548
public function testNormalize(File $file, array $expected)
4649
{
@@ -51,6 +54,9 @@ public function testNormalize(File $file, array $expected)
5154
$this->assertEquals($expected, $normalized);
5255
}
5356

57+
/**
58+
* @return iterable<array{0: File, 1: array<string, mixed>}>
59+
*/
5460
public static function normalizeDataProvider(): iterable
5561
{
5662
yield 'image from file' => [

src/platform/src/Bridge/HuggingFace/Tests/Contract/MessageBagNormalizerTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public function testGetSupportedTypes()
4646
$this->assertSame($expected, $normalizer->getSupportedTypes(null));
4747
}
4848

49+
/**
50+
* @param array<string, mixed> $expected
51+
*/
4952
#[DataProvider('provideMessageBagData')]
5053
public function testNormalize(MessageBag $bag, array $expected)
5154
{
@@ -74,7 +77,7 @@ public function testNormalize(MessageBag $bag, array $expected)
7477
}
7578

7679
/**
77-
* @return iterable<array{0: MessageBag, 1: array}>
80+
* @return iterable<array{0: MessageBag, 1: array<string, mixed>}>
7881
*/
7982
public static function provideMessageBagData(): iterable
8083
{

src/platform/src/Bridge/VertexAi/Tests/Contract/AssistantMessageNormalizerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public function testGetSupportedTypes()
3838
$this->assertSame([AssistantMessage::class => true], $normalizer->getSupportedTypes(null));
3939
}
4040

41+
/**
42+
* @param array<int|string, mixed> $expectedOutput
43+
*/
4144
#[DataProvider('normalizeDataProvider')]
4245
public function testNormalize(AssistantMessage $message, array $expectedOutput)
4346
{

src/platform/src/Bridge/VertexAi/Tests/Contract/MessageBagNormalizerTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public function testGetSupportedTypes()
4848
$this->assertSame($expected, $normalizer->getSupportedTypes(null));
4949
}
5050

51+
/**
52+
* @param array<string, mixed> $expected
53+
*/
5154
#[DataProvider('provideMessageBagData')]
5255
public function testNormalize(MessageBag $bag, array $expected)
5356
{
@@ -77,7 +80,7 @@ public function testNormalize(MessageBag $bag, array $expected)
7780
}
7881

7982
/**
80-
* @return iterable<array{0: MessageBag, 1: array}>
83+
* @return iterable<array{0: MessageBag, 1: array<string, mixed>}>
8184
*/
8285
public static function provideMessageBagData(): iterable
8386
{

src/platform/src/Bridge/VertexAi/Tests/Contract/ToolCallMessageNormalizerTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public function testGetSupportedTypes()
4242
$this->assertSame($expected, $normalizer->getSupportedTypes(null));
4343
}
4444

45+
/**
46+
* @param array<int, array<string, mixed>> $expected
47+
*/
4548
#[DataProvider('normalizeDataProvider')]
4649
public function testNormalize(ToolCallMessage $message, array $expected)
4750
{
@@ -53,7 +56,7 @@ public function testNormalize(ToolCallMessage $message, array $expected)
5356
}
5457

5558
/**
56-
* @return iterable<array{0: ToolCallMessage, 1: array}>
59+
* @return iterable<array{0: ToolCallMessage, 1: array<int, array<string, mixed>>}>
5760
*/
5861
public static function normalizeDataProvider(): iterable
5962
{

0 commit comments

Comments
 (0)