From dd93eee967551c65aefa71ff1c23a7db15b06b24 Mon Sep 17 00:00:00 2001 From: Zebulan Stanphill Date: Thu, 5 Aug 2021 00:04:36 -0500 Subject: [PATCH] Fix PHPStan error reported for ModelHydrator::hydrate. Line 45: Parameter #1 $callback of function call_user_func expects callable(): mixed, non-empty-string given. --- src/Hydrator/ModelHydrator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Hydrator/ModelHydrator.php b/src/Hydrator/ModelHydrator.php index 9d6e1ea..d54224b 100644 --- a/src/Hydrator/ModelHydrator.php +++ b/src/Hydrator/ModelHydrator.php @@ -23,6 +23,8 @@ use Psr\Http\Message\ResponseInterface; final class ModelHydrator implements Hydrator { /** + * @phpstan-param class-string $class + * * @return ResponseInterface */ public function hydrate(ResponseInterface $response, string $class) @@ -41,7 +43,7 @@ final class ModelHydrator implements Hydrator } if (is_subclass_of($class, ApiResponse::class)) { - $object = call_user_func($class.'::create', $data); + $object = call_user_func([$class, 'create'], $data); } else { $object = new $class($data); }