From 32ee179296c8e9661f6ded4aa2a87c93e0cb4567 Mon Sep 17 00:00:00 2001 From: Daniel Jakob Date: Sun, 12 Nov 2023 12:28:14 +0100 Subject: [PATCH] Replace docblock union-typehints in tests by native intersection type-hints --- tests/Dispatch/MethodDispatcherTest.php | 11 ++++------- tests/Dispatch/MethodValidatorTest.php | 5 ++--- tests/Dispatch/RequestValidatorTest.php | 6 ++---- tests/EndpointTest.php | 14 +++++++------- tests/Response/ResponseBuilderTest.php | 1 - 5 files changed, 15 insertions(+), 22 deletions(-) diff --git a/tests/Dispatch/MethodDispatcherTest.php b/tests/Dispatch/MethodDispatcherTest.php index 6a8ebdd..8b9c65e 100644 --- a/tests/Dispatch/MethodDispatcherTest.php +++ b/tests/Dispatch/MethodDispatcherTest.php @@ -16,16 +16,13 @@ class MethodDispatcherTest extends MockeryTestCase { - /** @var MockInterface|SchemaLoaderInterface */ - private MockInterface $schemaLoader; + private MockInterface&SchemaLoaderInterface $schemaLoader; - /** @var MethodValidatorInterface|MockInterface */ - private MockInterface $methodValidator; + private MockInterface&MethodValidatorInterface $methodValidator; - /** @var MethodProviderInterface|MockInterface */ - private MockInterface $methodProvider; + private MockInterface&MethodProviderInterface $methodProvider; - private MockInterface $logger; + private MockInterface&LoggerInterface $logger; private MethodDispatcher $subject; diff --git a/tests/Dispatch/MethodValidatorTest.php b/tests/Dispatch/MethodValidatorTest.php index 201f00b..4923121 100644 --- a/tests/Dispatch/MethodValidatorTest.php +++ b/tests/Dispatch/MethodValidatorTest.php @@ -17,10 +17,9 @@ class MethodValidatorTest extends MockeryTestCase { - /** @var Validator|MockInterface */ - private MockInterface $schemaValidator; + private MockInterface&Validator $schemaValidator; - private MockInterface $errorFormatter; + private MockInterface&ErrorFormatter $errorFormatter; private MethodValidator $subject; diff --git a/tests/Dispatch/RequestValidatorTest.php b/tests/Dispatch/RequestValidatorTest.php index 4bb9c25..f42afd0 100644 --- a/tests/Dispatch/RequestValidatorTest.php +++ b/tests/Dispatch/RequestValidatorTest.php @@ -17,11 +17,9 @@ class RequestValidatorTest extends MockeryTestCase { - /** @var MockInterface|SchemaLoaderInterface */ - private MockInterface $schemaLoader; + private MockInterface&SchemaLoaderInterface $schemaLoader; - /** @var MockInterface|Validator */ - private MockInterface $validator; + private MockInterface&Validator $validator; private RequestValidator $subject; diff --git a/tests/EndpointTest.php b/tests/EndpointTest.php index fc298a2..447ef89 100644 --- a/tests/EndpointTest.php +++ b/tests/EndpointTest.php @@ -28,19 +28,19 @@ class EndpointTest extends MockeryTestCase { - private MockInterface $requestValidator; + private MockInterface&RequestValidatorInterface $requestValidator; - private MockInterface $methodDispatcher; + private MockInterface&MethodDispatcherInterface $methodDispatcher; - private MockInterface $responseBuilder; + private MockInterface&ResponseBuilderInterface $responseBuilder; - private MockInterface $uuidFactory; + private MockInterface&UuidFactoryInterface $uuidFactory; - private MockInterface $streamFactory; + private MockInterface&StreamFactoryInterface $streamFactory; - private MockInterface $responseFactory; + private MockInterface&ResponseFactoryInterface $responseFactory; - private MockInterface $logger; + private MockInterface&LoggerInterface $logger; private Endpoint $subject; diff --git a/tests/Response/ResponseBuilderTest.php b/tests/Response/ResponseBuilderTest.php index c0c6a54..cf24418 100644 --- a/tests/Response/ResponseBuilderTest.php +++ b/tests/Response/ResponseBuilderTest.php @@ -11,7 +11,6 @@ class ResponseBuilderTest extends MockeryTestCase { - /** @var ResponseBuilder|null */ private ResponseBuilder $subject; public function setUp(): void