Tighten the types of functions that call Hydrator::hydrate.

This commit is contained in:
Zebulan Stanphill 2021-08-05 12:47:56 -05:00 committed by David Garcia
parent fdb25218a6
commit fe6a21e1d2
2 changed files with 8 additions and 0 deletions

View File

@ -59,6 +59,8 @@ abstract class HttpApi
} }
/** /**
* @phpstan-param class-string $class
*
* @return mixed|ResponseInterface * @return mixed|ResponseInterface
* *
* @throws \Exception * @throws \Exception

View File

@ -22,6 +22,9 @@ trait Pagination
{ {
abstract protected function httpGet(string $path, array $parameters = [], array $requestHeaders = []): ResponseInterface; abstract protected function httpGet(string $path, array $parameters = [], array $requestHeaders = []): ResponseInterface;
/**
* @phpstan-param class-string $className
*/
abstract protected function hydrateResponse(ResponseInterface $response, string $className); abstract protected function hydrateResponse(ResponseInterface $response, string $className);
public function nextPage(PagingProvider $response): ?PagingProvider public function nextPage(PagingProvider $response): ?PagingProvider
@ -44,6 +47,9 @@ trait Pagination
return $this->getPaginationUrl($response->getLastUrl(), get_class($response)); return $this->getPaginationUrl($response->getLastUrl(), get_class($response));
} }
/**
* @phpstan-param class-string $class
*/
private function getPaginationUrl(string $url, string $class): ?PagingProvider private function getPaginationUrl(string $url, string $class): ?PagingProvider
{ {
Assert::stringNotEmpty($class); Assert::stringNotEmpty($class);