Fix PHPStan error reported for ModelHydrator::hydrate.

Line 45: Parameter #1 $callback of function call_user_func expects callable(): mixed, non-empty-string given.
This commit is contained in:
Zebulan Stanphill 2021-08-05 00:04:36 -05:00 committed by David Garcia
parent 4ec42cdaf0
commit dd93eee967

View File

@ -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);
}