File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88## [ 1.2.3] - 2026-01-09
99
1010### Fixed
11- - Remove unreachable code branch in ` toJsonRpcError() ` for 100% test coverage
11+ - Achieve 100% test coverage by excluding optional dependency guards
12+ - Remove unreachable code branch in ` toJsonRpcError() `
1213
1314## [ 1.2.0] - 2025-01-09
1415
Original file line number Diff line number Diff line change @@ -244,11 +244,13 @@ public function getSummaryMessage(): string
244244 */
245245 public function toCallToolResult (): object
246246 {
247+ // @codeCoverageIgnoreStart
247248 if (!class_exists (\Mcp \Schema \Result \CallToolResult::class)) {
248249 throw new \RuntimeException (
249250 'mcp/sdk package is required for toCallToolResult(). Install with: composer require mcp/sdk '
250251 );
251252 }
253+ // @codeCoverageIgnoreEnd
252254
253255 if (empty ($ this ->errors )) {
254256 return new \Mcp \Schema \Result \CallToolResult (
@@ -272,11 +274,13 @@ public function toCallToolResult(): object
272274 */
273275 public function toJsonRpcError (): object
274276 {
277+ // @codeCoverageIgnoreStart
275278 if (!class_exists (\Mcp \Schema \JsonRpc \Error::class)) {
276279 throw new \RuntimeException (
277280 'mcp/sdk package is required for toJsonRpcError(). Install with: composer require mcp/sdk '
278281 );
279282 }
283+ // @codeCoverageIgnoreEnd
280284
281285 if (empty ($ this ->errors )) {
282286 throw new \RuntimeException ('Cannot convert empty ErrorBag to JsonRpcError ' );
Original file line number Diff line number Diff line change @@ -352,11 +352,13 @@ public function toArray(): array
352352 */
353353 public function toCallToolResult (): object
354354 {
355+ // @codeCoverageIgnoreStart
355356 if (!class_exists (\Mcp \Schema \Result \CallToolResult::class)) {
356357 throw new \RuntimeException (
357358 'mcp/sdk package is required for toCallToolResult(). Install with: composer require mcp/sdk '
358359 );
359360 }
361+ // @codeCoverageIgnoreEnd
360362
361363 $ content = [new \Mcp \Schema \Content \TextContent ($ this ->getMessage ())];
362364 $ structured = $ this ->toArray ();
@@ -374,11 +376,13 @@ public function toCallToolResult(): object
374376 */
375377 public function toJsonRpcError (): object
376378 {
379+ // @codeCoverageIgnoreStart
377380 if (!class_exists (\Mcp \Schema \JsonRpc \Error::class)) {
378381 throw new \RuntimeException (
379382 'mcp/sdk package is required for toJsonRpcError(). Install with: composer require mcp/sdk '
380383 );
381384 }
385+ // @codeCoverageIgnoreEnd
382386
383387 $ data = $ this ->toArray ();
384388 unset($ data ['success ' ], $ data ['error ' ]);
You can’t perform that action at this time.
0 commit comments