Skip to content

Commit f59f954

Browse files
committed
Fix code style
1 parent 1336ce7 commit f59f954

39 files changed

+317
-310
lines changed

examples/toolbox/firecrawl-crawl.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Symfony\AI\Platform\Message\Message;
1919
use Symfony\AI\Platform\Message\MessageBag;
2020

21-
require_once dirname(__DIR__) . '/bootstrap.php';
21+
require_once dirname(__DIR__).'/bootstrap.php';
2222

2323
$platform = PlatformFactory::create(env('OPENAI_API_KEY'), http_client());
2424
$model = new Gpt(Gpt::GPT_4O_MINI);
@@ -37,4 +37,4 @@
3737
$messages = new MessageBag(Message::ofUser('Crawl the following URL: https://symfony.com/doc/current/setup.html then resume it in less than 200 words.'));
3838
$result = $agent->call($messages);
3939

40-
echo $result->getContent() . \PHP_EOL;
40+
echo $result->getContent().\PHP_EOL;

examples/toolbox/firecrawl-map.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Symfony\AI\Platform\Message\Message;
1919
use Symfony\AI\Platform\Message\MessageBag;
2020

21-
require_once dirname(__DIR__) . '/bootstrap.php';
21+
require_once dirname(__DIR__).'/bootstrap.php';
2222

2323
$platform = PlatformFactory::create(env('OPENAI_API_KEY'), http_client());
2424
$model = new Gpt(Gpt::GPT_4O_MINI);
@@ -37,4 +37,4 @@
3737
$messages = new MessageBag(Message::ofUser('Retrieve all the links from https://symfony.com then list only the ones related to the Messenger component.'));
3838
$result = $agent->call($messages);
3939

40-
echo $result->getContent() . \PHP_EOL;
40+
echo $result->getContent().\PHP_EOL;

examples/toolbox/firecrawl-scrape.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Symfony\AI\Platform\Message\Message;
1919
use Symfony\AI\Platform\Message\MessageBag;
2020

21-
require_once dirname(__DIR__) . '/bootstrap.php';
21+
require_once dirname(__DIR__).'/bootstrap.php';
2222

2323
$platform = PlatformFactory::create(env('OPENAI_API_KEY'), http_client());
2424
$model = new Gpt(Gpt::GPT_4O_MINI);
@@ -37,4 +37,4 @@
3737
$messages = new MessageBag(Message::ofUser('Scrape the following URL: https://symfony.com/doc/current/setup.html then resume it in less than 200 words.'));
3838
$result = $agent->call($messages);
3939

40-
echo $result->getContent() . \PHP_EOL;
40+
echo $result->getContent().\PHP_EOL;

fixtures/SomeStructure.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313

1414
final class SomeStructure
1515
{
16+
public string $some;
17+
1618
public function __construct(?string $some = null)
1719
{
1820
if (null !== $some) {
1921
$this->some = $some;
2022
}
2123
}
22-
23-
public string $some;
2424
}

src/ai-bundle/tests/Security/IsGrantedToolAttributeListenerTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@ class IsGrantedToolAttributeListenerTest extends TestCase
4141
private EventDispatcherInterface $dispatcher;
4242
private AuthorizationCheckerInterface&MockObject $authChecker;
4343

44-
#[Before]
45-
protected function setupTool(): void
46-
{
47-
$this->dispatcher = new EventDispatcher();
48-
$this->authChecker = $this->createMock(AuthorizationCheckerInterface::class);
49-
$this->dispatcher->addListener(ToolCallArgumentsResolved::class, new IsGrantedToolAttributeListener($this->authChecker));
50-
}
51-
5244
#[TestWith([new ToolWithIsGrantedOnMethod(), new Tool(new ExecutionReference(ToolWithIsGrantedOnMethod::class, 'simple'), 'simple', '')])]
5345
#[TestWith([new ToolWithIsGrantedOnMethod(), new Tool(new ExecutionReference(ToolWithIsGrantedOnMethod::class, 'expressionAsSubject'), 'expressionAsSubject', '')])]
5446
#[TestWith([new ToolWithIsGrantedOnClass(), new Tool(new ExecutionReference(ToolWithIsGrantedOnClass::class, '__invoke'), 'ToolWithIsGrantedOnClass', '')])]
@@ -82,4 +74,12 @@ public function testItWillEvaluateSubjectExpression(object $tool, Tool $metadata
8274
$this->authChecker->expects($this->once())->method('isGranted')->with('test:permission', 44)->willReturn(true);
8375
$this->dispatcher->dispatch(new ToolCallArgumentsResolved($tool, $metadata, ['itemId' => 44]));
8476
}
77+
78+
#[Before]
79+
protected function setupTool(): void
80+
{
81+
$this->dispatcher = new EventDispatcher();
82+
$this->authChecker = $this->createMock(AuthorizationCheckerInterface::class);
83+
$this->dispatcher->addListener(ToolCallArgumentsResolved::class, new IsGrantedToolAttributeListener($this->authChecker));
84+
}
8585
}

src/mcp-sdk/src/Message/Notification.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ public function __construct(
2222
) {
2323
}
2424

25+
public function __toString(): string
26+
{
27+
return \sprintf('%s', $this->method);
28+
}
29+
2530
/**
2631
* @param array{method: string, params?: array<string, mixed>} $data
2732
*/
@@ -44,9 +49,4 @@ public function jsonSerialize(): array
4449
'params' => $this->params,
4550
];
4651
}
47-
48-
public function __toString(): string
49-
{
50-
return \sprintf('%s', $this->method);
51-
}
5252
}

src/mcp-sdk/src/Message/Request.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public function __construct(
2323
) {
2424
}
2525

26+
public function __toString(): string
27+
{
28+
return \sprintf('%s: %s', $this->id, $this->method);
29+
}
30+
2631
/**
2732
* @param array{id: string|int, method: string, params?: array<string, mixed>} $data
2833
*/
@@ -47,9 +52,4 @@ public function jsonSerialize(): array
4752
'params' => $this->params,
4853
];
4954
}
50-
51-
public function __toString(): string
52-
{
53-
return \sprintf('%s: %s', $this->id, $this->method);
54-
}
5555
}

src/mcp-sdk/src/Server/NotificationHandler/InitializedHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
final class InitializedHandler extends BaseNotificationHandler
1717
{
18-
protected function supportedNotification(): string
18+
public function handle(Notification $notification): void
1919
{
20-
return 'initialized';
2120
}
2221

23-
public function handle(Notification $notification): void
22+
protected function supportedNotification(): string
2423
{
24+
return 'initialized';
2525
}
2626
}

src/mcp-sdk/tests/Message/FactoryTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@ protected function setUp(): void
3030
$this->factory = new Factory();
3131
}
3232

33-
/**
34-
* @param iterable<mixed> $items
35-
*/
36-
private function first(iterable $items): mixed
37-
{
38-
foreach ($items as $item) {
39-
return $item;
40-
}
41-
42-
return null;
43-
}
44-
4533
public function testCreateRequest()
4634
{
4735
$json = '{"jsonrpc": "2.0", "method": "test_method", "params": {"foo": "bar"}, "id": 123}';
@@ -91,4 +79,16 @@ public function testBatchMissingMethod()
9179
$result = array_shift($results);
9280
$this->assertInstanceOf(Notification::class, $result);
9381
}
82+
83+
/**
84+
* @param iterable<mixed> $items
85+
*/
86+
private function first(iterable $items): mixed
87+
{
88+
foreach ($items as $item) {
89+
return $item;
90+
}
91+
92+
return null;
93+
}
9494
}

src/platform/src/Bridge/Anthropic/Contract/DocumentNormalizer.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,6 @@
2121
*/
2222
class DocumentNormalizer extends ModelContractNormalizer
2323
{
24-
protected function supportedDataClass(): string
25-
{
26-
return Document::class;
27-
}
28-
29-
protected function supportsModel(Model $model): bool
30-
{
31-
return $model instanceof Claude;
32-
}
33-
3424
/**
3525
* @param Document $data
3626
*
@@ -47,4 +37,14 @@ public function normalize(mixed $data, ?string $format = null, array $context =
4737
],
4838
];
4939
}
40+
41+
protected function supportedDataClass(): string
42+
{
43+
return Document::class;
44+
}
45+
46+
protected function supportsModel(Model $model): bool
47+
{
48+
return $model instanceof Claude;
49+
}
5050
}

0 commit comments

Comments
 (0)