Skip to content

Commit 455c512

Browse files
author
klapaudius
committed
Refactor tests and MCPProtocol for cleanup and improvements
Updated test annotations for clarity and consistency by adding #[Small] and removing unused #[CoversClass]. Simplified MCPProtocol by using a readonly constructor property, eliminating redundant class property.
1 parent e1a8379 commit 455c512

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/Protocol/MCPProtocol.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ final class MCPProtocol implements MCPProtocolInterface
2424
{
2525
public const PROTOCOL_VERSION = '2024-11-05';
2626

27-
private TransportInterface $transport;
28-
2927
/**
3028
* @var RequestHandler[]
3129
*/
@@ -40,9 +38,8 @@ final class MCPProtocol implements MCPProtocolInterface
4038
* @param TransportInterface $transport The transport implementation to use for communication
4139
* @return void
4240
*/
43-
public function __construct(TransportInterface $transport)
41+
public function __construct(private readonly TransportInterface $transport)
4442
{
45-
$this->transport = $transport;
4643
$this->transport->onMessage([$this, 'handleMessage']);
4744
}
4845

tests/Services/ToolService/ToolParamsValidatorTest.php

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

55
use KLP\KlpMcpServer\Exceptions\ToolParamsValidatorException;
66
use KLP\KlpMcpServer\Services\ToolService\ToolParamsValidator;
7+
use PHPUnit\Framework\Attributes\Small;
78
use PHPUnit\Framework\TestCase;
89

9-
/**
10-
* Tests for the ToolParamsValidator class and its validate method.
11-
*/
10+
#[Small]
1211
class ToolParamsValidatorTest extends TestCase
1312
{
1413
public function test_validate_with_valid_arguments(): void

0 commit comments

Comments
 (0)