Skip to content

Commit e305bee

Browse files
committed
minor #643 [AI Bundle][Agent][Platform][Store] Use imports instead of FQCN inline (chr-hertel)
This PR was merged into the main branch. Discussion ---------- [AI Bundle][Agent][Platform][Store] Use imports instead of FQCN inline | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Docs? | no | Issues | | License | MIT Commits ------- 96f824f Use imports instead of FQCN inline
2 parents c74b52a + 96f824f commit e305bee

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

src/agent/tests/ChatTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\Attributes\CoversClass;
1515
use PHPUnit\Framework\Attributes\Small;
1616
use PHPUnit\Framework\Attributes\UsesClass;
17+
use PHPUnit\Framework\MockObject\MockObject;
1718
use PHPUnit\Framework\TestCase;
1819
use Symfony\AI\Agent\AgentInterface;
1920
use Symfony\AI\Agent\Chat;
@@ -30,8 +31,8 @@
3031
#[Small]
3132
final class ChatTest extends TestCase
3233
{
33-
private AgentInterface&\PHPUnit\Framework\MockObject\MockObject $agent;
34-
private MessageStoreInterface&\PHPUnit\Framework\MockObject\MockObject $store;
34+
private AgentInterface&MockObject $agent;
35+
private MessageStoreInterface&MockObject $store;
3536
private Chat $chat;
3637

3738
protected function setUp(): void

src/ai-bundle/src/Command/ChatCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Symfony\Component\Console\Command\Command;
2121
use Symfony\Component\Console\Completion\CompletionInput;
2222
use Symfony\Component\Console\Completion\CompletionSuggestions;
23+
use Symfony\Component\Console\Helper\QuestionHelper;
2324
use Symfony\Component\Console\Input\InputArgument;
2425
use Symfony\Component\Console\Input\InputInterface;
2526
use Symfony\Component\Console\Output\OutputInterface;
@@ -96,7 +97,7 @@ protected function interact(InputInterface $input, OutputInterface $output): voi
9697
);
9798
$question->setErrorMessage('Agent %s is invalid.');
9899

99-
/** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
100+
/** @var QuestionHelper $helper */
100101
$helper = $this->getHelper('question');
101102
$selectedAgent = $helper->ask($input, $output, $question);
102103

src/platform/tests/Bridge/Ollama/OllamaClientTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
use PHPUnit\Framework\TestCase;
1717
use Symfony\AI\Platform\Bridge\Ollama\Ollama;
1818
use Symfony\AI\Platform\Bridge\Ollama\OllamaClient;
19+
use Symfony\AI\Platform\Bridge\Ollama\OllamaResultConverter;
1920
use Symfony\AI\Platform\Bridge\Ollama\PlatformFactory;
2021
use Symfony\AI\Platform\Model;
22+
use Symfony\AI\Platform\Result\RawHttpResult;
2123
use Symfony\AI\Platform\Result\StreamResult;
2224
use Symfony\Component\HttpClient\MockHttpClient;
2325
use Symfony\Component\HttpClient\Response\JsonMockResponse;
@@ -153,8 +155,8 @@ public function testStreamingConverterWithDirectResponse()
153155
]);
154156

155157
$mockResponse = $mockHttpClient->request('GET', 'http://test.example');
156-
$rawResult = new \Symfony\AI\Platform\Result\RawHttpResult($mockResponse);
157-
$converter = new \Symfony\AI\Platform\Bridge\Ollama\OllamaResultConverter();
158+
$rawResult = new RawHttpResult($mockResponse);
159+
$converter = new OllamaResultConverter();
158160

159161
$result = $converter->convert($rawResult, ['stream' => true]);
160162

@@ -170,7 +172,7 @@ public function testStreamingConverterWithDirectResponse()
170172
]);
171173

172174
$regularMockResponse = $regularMockHttpClient->request('GET', 'http://test.example');
173-
$regularRawResult = new \Symfony\AI\Platform\Result\RawHttpResult($regularMockResponse);
175+
$regularRawResult = new RawHttpResult($regularMockResponse);
174176
$regularResult = $converter->convert($regularRawResult, ['stream' => false]);
175177

176178
$this->assertNotInstanceOf(StreamResult::class, $regularResult);

src/store/tests/Document/VectorizerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use Symfony\AI\Store\Document\TextDocument;
3434
use Symfony\AI\Store\Document\VectorDocument;
3535
use Symfony\AI\Store\Document\Vectorizer;
36+
use Symfony\AI\Store\Exception\RuntimeException;
3637
use Symfony\AI\Store\Tests\Double\PlatformTestHandler;
3738
use Symfony\Component\HttpClient\Response\MockResponse;
3839
use Symfony\Component\Uid\Uuid;
@@ -375,7 +376,7 @@ public function testVectorizeStringThrowsExceptionWhenNoVectorReturned()
375376

376377
$vectorizer = new Vectorizer($platform, $model);
377378

378-
$this->expectException(\Symfony\AI\Store\Exception\RuntimeException::class);
379+
$this->expectException(RuntimeException::class);
379380
$this->expectExceptionMessage('No vector returned for string vectorization.');
380381

381382
$vectorizer->vectorize($text);

0 commit comments

Comments
 (0)