From fdb25218a6b8a164183292cd0ff42c335879d944 Mon Sep 17 00:00:00 2001 From: Zebulan Stanphill Date: Thu, 5 Aug 2021 12:44:53 -0500 Subject: [PATCH] Tighten types for Hydrator and its subclasses to address issue caught by Psalm. The issue caught by Psalm: Argument 2 of Mailgun\Hydrator\ModelHydrator::hydrate has the more specific type 'class-string', expecting 'string' as defined by Mailgun\Hydrator\Hydrator::hydrate --- src/Hydrator/ArrayHydrator.php | 2 ++ src/Hydrator/Hydrator.php | 2 ++ src/Hydrator/NoopHydrator.php | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/Hydrator/ArrayHydrator.php b/src/Hydrator/ArrayHydrator.php index 5b453e4..9c49601 100644 --- a/src/Hydrator/ArrayHydrator.php +++ b/src/Hydrator/ArrayHydrator.php @@ -22,6 +22,8 @@ use Psr\Http\Message\ResponseInterface; final class ArrayHydrator implements Hydrator { /** + * @phpstan-param class-string $class + * * @return array */ public function hydrate(ResponseInterface $response, string $class) diff --git a/src/Hydrator/Hydrator.php b/src/Hydrator/Hydrator.php index 6819dc3..f6df687 100644 --- a/src/Hydrator/Hydrator.php +++ b/src/Hydrator/Hydrator.php @@ -20,6 +20,8 @@ use Psr\Http\Message\ResponseInterface; interface Hydrator { /** + * @phpstan-param class-string $class + * * @throws HydrationException */ public function hydrate(ResponseInterface $response, string $class); diff --git a/src/Hydrator/NoopHydrator.php b/src/Hydrator/NoopHydrator.php index 72ad2ed..ae5f030 100644 --- a/src/Hydrator/NoopHydrator.php +++ b/src/Hydrator/NoopHydrator.php @@ -21,6 +21,8 @@ use Psr\Http\Message\ResponseInterface; final class NoopHydrator implements Hydrator { /** + * @phpstan-param class-string $class + * * @throws \LogicException */ public function hydrate(ResponseInterface $response, string $class)