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
This commit is contained in:
Zebulan Stanphill 2021-08-05 12:44:53 -05:00 committed by David Garcia
parent dd93eee967
commit fdb25218a6
3 changed files with 6 additions and 0 deletions

View File

@ -22,6 +22,8 @@ use Psr\Http\Message\ResponseInterface;
final class ArrayHydrator implements Hydrator final class ArrayHydrator implements Hydrator
{ {
/** /**
* @phpstan-param class-string $class
*
* @return array * @return array
*/ */
public function hydrate(ResponseInterface $response, string $class) public function hydrate(ResponseInterface $response, string $class)

View File

@ -20,6 +20,8 @@ use Psr\Http\Message\ResponseInterface;
interface Hydrator interface Hydrator
{ {
/** /**
* @phpstan-param class-string $class
*
* @throws HydrationException * @throws HydrationException
*/ */
public function hydrate(ResponseInterface $response, string $class); public function hydrate(ResponseInterface $response, string $class);

View File

@ -21,6 +21,8 @@ use Psr\Http\Message\ResponseInterface;
final class NoopHydrator implements Hydrator final class NoopHydrator implements Hydrator
{ {
/** /**
* @phpstan-param class-string $class
*
* @throws \LogicException * @throws \LogicException
*/ */
public function hydrate(ResponseInterface $response, string $class) public function hydrate(ResponseInterface $response, string $class)