Skip to content

Commit 3641de9

Browse files
chr-hertelclaude
andcommitted
Use Mcp\Exception\InvalidArgumentException instead of native
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0d2c21c commit 3641de9

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/Server/Session/SessionManager.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Mcp\Server\Session;
1313

14+
use Mcp\Exception\InvalidArgumentException;
1415
use Psr\Log\LoggerInterface;
1516
use Psr\Log\NullLogger;
1617
use Symfony\Component\Uid\Uuid;
@@ -33,10 +34,10 @@ public function __construct(
3334
private readonly int $gcDivisor = 100,
3435
) {
3536
if ($gcProbability < 0) {
36-
throw new \InvalidArgumentException('gcProbability must be greater than or equal to 0.');
37+
throw new InvalidArgumentException('gcProbability must be greater than or equal to 0.');
3738
}
3839
if ($gcDivisor < 1) {
39-
throw new \InvalidArgumentException('gcDivisor must be greater than or equal to 1.');
40+
throw new InvalidArgumentException('gcDivisor must be greater than or equal to 1.');
4041
}
4142
}
4243

tests/Unit/Server/Session/SessionManagerTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Mcp\Tests\Unit\Server\Session;
1313

14+
use Mcp\Exception\InvalidArgumentException;
1415
use Mcp\Server\Session\InMemorySessionStore;
1516
use Mcp\Server\Session\SessionManager;
1617
use PHPUnit\Framework\TestCase;
@@ -56,15 +57,15 @@ public function testGcAlwaysRunsWhenProbabilityExceedsDivisor(): void
5657

5758
public function testGcProbabilityMustBeNonNegative(): void
5859
{
59-
$this->expectException(\InvalidArgumentException::class);
60+
$this->expectException(InvalidArgumentException::class);
6061
$this->expectExceptionMessage('gcProbability must be greater than or equal to 0.');
6162

6263
new SessionManager(new InMemorySessionStore(), gcProbability: -1);
6364
}
6465

6566
public function testGcDivisorMustBePositive(): void
6667
{
67-
$this->expectException(\InvalidArgumentException::class);
68+
$this->expectException(InvalidArgumentException::class);
6869
$this->expectExceptionMessage('gcDivisor must be greater than or equal to 1.');
6970

7071
new SessionManager(new InMemorySessionStore(), gcDivisor: 0);

0 commit comments

Comments
 (0)