From f8129a654ca22e935b475fa46857cc42c5666b41 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Wed, 31 Jul 2024 07:59:50 +0200 Subject: [PATCH] Ignore code from code coverage for handling of errors for edge cases that I do not know how to test --- src/Framework/MockObject/Runtime/ReturnValueGenerator.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Framework/MockObject/Runtime/ReturnValueGenerator.php b/src/Framework/MockObject/Runtime/ReturnValueGenerator.php index 3854190879..7cf1cd6a00 100644 --- a/src/Framework/MockObject/Runtime/ReturnValueGenerator.php +++ b/src/Framework/MockObject/Runtime/ReturnValueGenerator.php @@ -184,6 +184,7 @@ private function newInstanceOf(string $stubClassName, string $className, string { try { return (new ReflectionClass($stubClassName))->newInstanceWithoutConstructor(); + // @codeCoverageIgnoreStart } catch (Throwable $t) { throw new RuntimeException( sprintf( @@ -193,6 +194,7 @@ private function newInstanceOf(string $stubClassName, string $className, string $t->getMessage(), ), ); + // @codeCoverageIgnoreEnd } } @@ -207,6 +209,7 @@ private function testDoubleFor(string $type, string $className, string $methodNa { try { return (new Generator)->testDouble($type, false, [], [], '', false); + // @codeCoverageIgnoreStart } catch (Throwable $t) { throw new RuntimeException( sprintf( @@ -216,6 +219,7 @@ private function testDoubleFor(string $type, string $className, string $methodNa $t->getMessage(), ), ); + // @codeCoverageIgnoreEnd } } @@ -230,6 +234,7 @@ private function testDoubleForIntersectionOfInterfaces(array $types, string $cla { try { return (new Generator)->testDoubleForInterfaceIntersection($types, false); + // @codeCoverageIgnoreStart } catch (Throwable $t) { throw new RuntimeException( sprintf( @@ -239,6 +244,7 @@ private function testDoubleForIntersectionOfInterfaces(array $types, string $cla $t->getMessage(), ), ); + // @codeCoverageIgnoreEnd } } }