Skip to content

Commit a0561c6

Browse files
committed
refactor: introduce Interface suffic
1 parent 0d98905 commit a0561c6

File tree

13 files changed

+27
-27
lines changed

13 files changed

+27
-27
lines changed

examples/cli/src/Builder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
use PhpLlm\McpSdk\Capability\PromptChain;
66
use PhpLlm\McpSdk\Capability\ResourceChain;
77
use PhpLlm\McpSdk\Capability\ToolChain;
8-
use PhpLlm\McpSdk\Server\NotificationHandler;
8+
use PhpLlm\McpSdk\Server\NotificationHandlerInterface;
99
use PhpLlm\McpSdk\Server\NotificationHandler\InitializedHandler;
10-
use PhpLlm\McpSdk\Server\RequestHandler;
10+
use PhpLlm\McpSdk\Server\RequestHandlerInterface;
1111
use PhpLlm\McpSdk\Server\RequestHandler\InitializeHandler;
1212
use PhpLlm\McpSdk\Server\RequestHandler\PingHandler;
1313
use PhpLlm\McpSdk\Server\RequestHandler\PromptGetHandler;
@@ -20,7 +20,7 @@
2020
class Builder
2121
{
2222
/**
23-
* @return list<RequestHandler>
23+
* @return list<RequestHandlerInterface>
2424
*/
2525
public static function buildRequestHandlers(): array
2626
{
@@ -49,7 +49,7 @@ public static function buildRequestHandlers(): array
4949
}
5050

5151
/**
52-
* @return list<NotificationHandler>
52+
* @return list<NotificationHandlerInterface>
5353
*/
5454
public static function buildNotificationHandlers(): array
5555
{

src/Server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace PhpLlm\McpSdk;
66

77
use PhpLlm\McpSdk\Server\JsonRpcHandler;
8-
use PhpLlm\McpSdk\Server\Transport;
8+
use PhpLlm\McpSdk\Server\TransportInterface;
99
use Psr\Log\LoggerInterface;
1010
use Psr\Log\NullLogger;
1111

@@ -17,7 +17,7 @@ public function __construct(
1717
) {
1818
}
1919

20-
public function connect(Transport $transport): void
20+
public function connect(TransportInterface $transport): void
2121
{
2222
$transport->initialize();
2323
$this->logger->info('Transport initialized');

src/Server/JsonRpcHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@
1717
readonly class JsonRpcHandler
1818
{
1919
/**
20-
* @var array<int, RequestHandler>
20+
* @var array<int, RequestHandlerInterface>
2121
*/
2222
private array $requestHandlers;
2323

2424
/**
25-
* @var array<int, NotificationHandler>
25+
* @var array<int, NotificationHandlerInterface>
2626
*/
2727
private array $notificationHandlers;
2828

2929
/**
30-
* @param iterable<RequestHandler> $requestHandlers
31-
* @param iterable<NotificationHandler> $notificationHandlers
30+
* @param iterable<RequestHandlerInterface> $requestHandlers
31+
* @param iterable<NotificationHandlerInterface> $notificationHandlers
3232
*/
3333
public function __construct(
3434
private Factory $messageFactory,

src/Server/NotificationHandler/BaseNotificationHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace PhpLlm\McpSdk\Server\NotificationHandler;
66

77
use PhpLlm\McpSdk\Message\Notification;
8-
use PhpLlm\McpSdk\Server\NotificationHandler;
8+
use PhpLlm\McpSdk\Server\NotificationHandlerInterface;
99

10-
abstract class BaseNotificationHandler implements NotificationHandler
10+
abstract class BaseNotificationHandler implements NotificationHandlerInterface
1111
{
1212
public function supports(Notification $message): bool
1313
{

src/Server/NotificationHandler.php renamed to src/Server/NotificationHandlerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use PhpLlm\McpSdk\Message\Notification;
88

9-
interface NotificationHandler
9+
interface NotificationHandlerInterface
1010
{
1111
public function supports(Notification $message): bool;
1212

src/Server/RequestHandler/BaseRequestHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace PhpLlm\McpSdk\Server\RequestHandler;
66

77
use PhpLlm\McpSdk\Message\Request;
8-
use PhpLlm\McpSdk\Server\RequestHandler;
8+
use PhpLlm\McpSdk\Server\RequestHandlerInterface;
99

10-
abstract class BaseRequestHandler implements RequestHandler
10+
abstract class BaseRequestHandler implements RequestHandlerInterface
1111
{
1212
public function supports(Request $message): bool
1313
{

src/Server/RequestHandler.php renamed to src/Server/RequestHandlerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use PhpLlm\McpSdk\Message\Request;
99
use PhpLlm\McpSdk\Message\Response;
1010

11-
interface RequestHandler
11+
interface RequestHandlerInterface
1212
{
1313
public function supports(Request $message): bool;
1414

src/Server/Transport/Sse/Store/CachePoolStore.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace PhpLlm\McpSdk\Server\Transport\Sse\Store;
66

7-
use PhpLlm\McpSdk\Server\Transport\Sse\Store;
7+
use PhpLlm\McpSdk\Server\Transport\Sse\StoreInterface;
88
use Psr\Cache\CacheItemPoolInterface;
99
use Symfony\Component\Uid\Uuid;
1010

11-
final readonly class CachePoolStore implements Store
11+
final readonly class CachePoolStore implements StoreInterface
1212
{
1313
public function __construct(
1414
private CacheItemPoolInterface $cachePool,

src/Server/Transport/Sse/Store.php renamed to src/Server/Transport/Sse/StoreInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Symfony\Component\Uid\Uuid;
88

9-
interface Store
9+
interface StoreInterface
1010
{
1111
public function push(Uuid $id, string $message): void;
1212

src/Server/Transport/Sse/StreamTransport.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
namespace PhpLlm\McpSdk\Server\Transport\Sse;
66

7-
use PhpLlm\McpSdk\Server\Transport;
7+
use PhpLlm\McpSdk\Server\TransportInterface;
88
use Symfony\Component\Uid\Uuid;
99

10-
final readonly class StreamTransport implements Transport
10+
final readonly class StreamTransport implements TransportInterface
1111
{
1212
public function __construct(
1313
private string $messageEndpoint,
14-
private Store $store,
14+
private StoreInterface $store,
1515
private Uuid $id,
1616
) {
1717
}

src/Server/Transport/Stdio/SymfonyConsoleTransport.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
namespace PhpLlm\McpSdk\Server\Transport\Stdio;
66

7-
use PhpLlm\McpSdk\Server\Transport;
7+
use PhpLlm\McpSdk\Server\TransportInterface;
88
use Symfony\Component\Console\Input\InputInterface;
99
use Symfony\Component\Console\Input\StreamableInputInterface;
1010
use Symfony\Component\Console\Output\OutputInterface;
1111

1212
/**
1313
* Heavily inspired by https://jolicode.com/blog/mcp-the-open-protocol-that-turns-llm-chatbots-into-intelligent-agents.
1414
*/
15-
final class SymfonyConsoleTransport implements Transport
15+
final class SymfonyConsoleTransport implements TransportInterface
1616
{
1717
private string $buffer = '';
1818

src/Server/Transport.php renamed to src/Server/TransportInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace PhpLlm\McpSdk\Server;
66

7-
interface Transport
7+
interface TransportInterface
88
{
99
public function initialize(): void;
1010

tests/Fixtures/InMemoryTransport.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace PhpLlm\McpSdk\Tests\Fixtures;
44

5-
use PhpLlm\McpSdk\Server\Transport;
5+
use PhpLlm\McpSdk\Server\TransportInterface;
66

7-
class InMemoryTransport implements Transport
7+
class InMemoryTransport implements TransportInterface
88
{
99
private bool $connected = true;
1010

0 commit comments

Comments
 (0)