Skip to content

Commit 61fc44b

Browse files
committed
[Agent] Replace string concatenation with sprintf in exception messages
1 parent a086203 commit 61fc44b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/agent/tests/AgentTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function testConstructorThrowsExceptionForInvalidInputProcessor()
9292
$invalidProcessor = new \stdClass();
9393

9494
$this->expectException(InvalidArgumentException::class);
95-
$this->expectExceptionMessage('Processor "stdClass" must implement "'.InputProcessorInterface::class.'".');
95+
$this->expectExceptionMessage(\sprintf('Processor "stdClass" must implement "%s".', InputProcessorInterface::class));
9696

9797
/* @phpstan-ignore-next-line */
9898
new Agent($platform, $model, [$invalidProcessor]);
@@ -105,7 +105,7 @@ public function testConstructorThrowsExceptionForInvalidOutputProcessor()
105105
$invalidProcessor = new \stdClass();
106106

107107
$this->expectException(InvalidArgumentException::class);
108-
$this->expectExceptionMessage('Processor "stdClass" must implement "'.OutputProcessorInterface::class.'".');
108+
$this->expectExceptionMessage(\sprintf('Processor "stdClass" must implement "%s".', OutputProcessorInterface::class));
109109

110110
/* @phpstan-ignore-next-line */
111111
new Agent($platform, $model, [], [$invalidProcessor]);

src/agent/tests/InputProcessor/ModelOverrideInputProcessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function testProcessInputWithoutModelOption()
4848
public function testProcessInputWithInvalidModelOption()
4949
{
5050
$this->expectException(InvalidArgumentException::class);
51-
$this->expectExceptionMessage('Option "model" must be an instance of "'.Model::class.'".');
51+
$this->expectExceptionMessage(\sprintf('Option "model" must be an instance of "%s".', Model::class));
5252

5353
$gpt = new Gpt(Gpt::GPT_4O);
5454
$model = new MessageBag();

src/agent/tests/Toolbox/ToolboxTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function testExecuteWithUnknownTool()
154154
public function testExecuteWithMisconfiguredTool()
155155
{
156156
$this->expectException(ToolConfigurationException::class);
157-
$this->expectExceptionMessage('Method "foo" not found in tool "'.ToolMisconfigured::class.'".');
157+
$this->expectExceptionMessage(\sprintf('Method "foo" not found in tool "%s".', ToolMisconfigured::class));
158158

159159
$toolbox = new Toolbox([new ToolMisconfigured()], new ReflectionToolFactory());
160160

0 commit comments

Comments
 (0)