Skip to content

Commit 0cb5c02

Browse files
committed
bug #1168 Address PHP and PHPUnit deprecations (chr-hertel)
This PR was merged into the main branch. Discussion ---------- Address PHP and PHPUnit deprecations | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Docs? | no | Issues | | License | MIT Addressing deprecations/notices raised while executing PHPUnit - mostly PHPUnit and PHP deprecations Commits ------- 8c1c402 Address PHP and PHPUnit deprecations
2 parents 8f3e66d + 8c1c402 commit 0cb5c02

File tree

6 files changed

+5
-11
lines changed

6 files changed

+5
-11
lines changed

demo/tests/Blog/Command/StreamCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class StreamCommandTest extends TestCase
2626
{
2727
public function testStreamCommandOutputsStreamedContentAndSuccess()
2828
{
29-
$mockAgent = $this->createMock(AgentInterface::class);
29+
$mockAgent = $this->createStub(AgentInterface::class);
3030
$mockAgent
3131
->method('call')
3232
->with($this->isInstanceOf(MessageBag::class), ['stream' => true])

src/agent/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"symfony/ai-platform": "@dev",
3232
"symfony/clock": "^7.3|^8.0",
3333
"symfony/http-client": "^7.3|^8.0",
34+
"symfony/polyfill-php85": "^1.33",
3435
"symfony/property-access": "^7.3|^8.0",
3536
"symfony/property-info": "^7.3|^8.0",
3637
"symfony/serializer": "^7.3|^8.0",

src/agent/src/Memory/EmbeddingProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function load(Input $input): array
3636
{
3737
$messages = $input->getMessageBag()->getMessages();
3838
/** @var MessageInterface|null $userMessage */
39-
$userMessage = $messages[array_key_last($messages)] ?? null;
39+
$userMessage = array_last($messages) ?? null;
4040

4141
if (!$userMessage instanceof UserMessage) {
4242
return [];

src/ai-bundle/tests/Command/AgentCallCommandTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ public function testCommandFailsWithInvalidAgent()
5353
}
5454
}
5555

56-
public function testCommandPromptsForAgentSelectionWhenNoneProvided()
57-
{
58-
$this->markTestSkipped('CommandTester does not properly support interact() method with question helper');
59-
}
60-
6156
public function testCommandExecutesWithValidAgent()
6257
{
6358
$agent = $this->createMock(AgentInterface::class);

src/mcp-bundle/tests/DependencyInjection/McpPassTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
use Symfony\Component\DependencyInjection\Definition;
1919
use Symfony\Component\DependencyInjection\Reference;
2020

21-
/**
22-
* @covers \Symfony\AI\McpBundle\DependencyInjection\McpPass
23-
*/
2421
final class McpPassTest extends TestCase
2522
{
2623
public function testCreatesServiceLocatorForAllMcpServices()

src/platform/src/Bridge/HuggingFace/ResultConverter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ public function convert(RawResultInterface|RawHttpResult $result, array $options
5757

5858
$headers = $httpResponse->getHeaders(false);
5959
$contentType = $headers['content-type'][0] ?? null;
60-
$content = str_contains($contentType, 'application/json') ? $httpResponse->toArray(false) : $httpResponse->getContent(false);
60+
$content = null !== $contentType && str_contains($contentType, 'application/json')
61+
? $httpResponse->toArray(false) : $httpResponse->getContent(false);
6162

6263
if (str_starts_with((string) $httpResponse->getStatusCode(), '4')) {
6364
$message = match (true) {

0 commit comments

Comments
 (0)