From 03164e51a3b55aa4f973f6770fb0331c07edc4a5 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 4 Sep 2025 23:42:23 +0200 Subject: [PATCH] Add missing ConfigurationException and update PHPStan baseline - Add ConfigurationException class in src/Exception/ConfigurationException.php - Update ServerBuilder to use the new ConfigurationException - Regenerate PHPStan baseline to account for the new exception class, reducing errors from 160+ to 124 --- phpstan-baseline.neon | 12 ------------ src/Exception/ConfigurationException.php | 19 +++++++++++++++++++ src/Server/ServerBuilder.php | 1 + 3 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 src/Exception/ConfigurationException.php diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 2b758bb5..c550bc03 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -558,12 +558,6 @@ parameters: count: 1 path: src/Server/RequestHandler/ListToolsHandler.php - - - message: '#^Instantiated class Mcp\\Server\\ConfigurationException not found\.$#' - identifier: class.notFound - count: 4 - path: src/Server/ServerBuilder.php - - message: '#^Method Mcp\\Server\\ServerBuilder\:\:getCompletionProviders\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -701,9 +695,3 @@ parameters: identifier: property.onlyWritten count: 1 path: src/Server/ServerBuilder.php - - - - message: '#^Throwing object of an unknown class Mcp\\Server\\ConfigurationException\.$#' - identifier: class.notFound - count: 4 - path: src/Server/ServerBuilder.php diff --git a/src/Exception/ConfigurationException.php b/src/Exception/ConfigurationException.php new file mode 100644 index 00000000..b53333e0 --- /dev/null +++ b/src/Exception/ConfigurationException.php @@ -0,0 +1,19 @@ + + */ +class ConfigurationException extends InvalidArgumentException +{ +} diff --git a/src/Server/ServerBuilder.php b/src/Server/ServerBuilder.php index 1f4808ed..f8867567 100644 --- a/src/Server/ServerBuilder.php +++ b/src/Server/ServerBuilder.php @@ -21,6 +21,7 @@ use Mcp\Capability\Registry; use Mcp\Capability\Registry\Container; use Mcp\Capability\Registry\ReferenceHandler; +use Mcp\Exception\ConfigurationException; use Mcp\JsonRpc\Handler; use Mcp\Schema\Annotations; use Mcp\Schema\Implementation;