diff --git a/src/lib/Pagination/Pagerfanta/AdapterFactory/SearchHitAdapterFactory.php b/src/lib/Pagination/Pagerfanta/AdapterFactory/SearchHitAdapterFactory.php index 3dad98abab..9bc7e2e668 100644 --- a/src/lib/Pagination/Pagerfanta/AdapterFactory/SearchHitAdapterFactory.php +++ b/src/lib/Pagination/Pagerfanta/AdapterFactory/SearchHitAdapterFactory.php @@ -14,7 +14,7 @@ use Ibexa\Core\Pagination\Pagerfanta\ContentSearchHitAdapter; use Ibexa\Core\Pagination\Pagerfanta\FixedSearchResultHitAdapter; use Ibexa\Core\Pagination\Pagerfanta\LocationSearchHitAdapter; -use Pagerfanta\Adapter\AdapterInterface; +use Ibexa\Core\Pagination\Pagerfanta\SearchResultAdapter; /** * @internal @@ -24,19 +24,14 @@ final class SearchHitAdapterFactory implements SearchHitAdapterFactoryInterface { /** @var \Ibexa\Contracts\Core\Repository\SearchService */ - private $searchService; + private SearchService $searchService; public function __construct(SearchService $searchService) { $this->searchService = $searchService; } - /** - * @phpstan-param TSearchLanguageFilter $languageFilter - * - * @phpstan-return \Pagerfanta\Adapter\AdapterInterface<\Ibexa\Contracts\Core\Repository\Values\ValueObject> - */ - public function createAdapter(Query $query, array $languageFilter = []): AdapterInterface + public function createAdapter(Query $query, array $languageFilter = []): SearchResultAdapter { if ($query instanceof LocationQuery) { return new LocationSearchHitAdapter($query, $this->searchService, $languageFilter); @@ -45,14 +40,7 @@ public function createAdapter(Query $query, array $languageFilter = []): Adapter return new ContentSearchHitAdapter($query, $this->searchService, $languageFilter); } - /** - * @phpstan-return \Pagerfanta\Adapter\AdapterInterface<\Ibexa\Contracts\Core\Repository\Values\ValueObject> - * - * @phpstan-param TSearchLanguageFilter $languageFilter - * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - */ - public function createFixedAdapter(Query $query, array $languageFilter = []): AdapterInterface + public function createFixedAdapter(Query $query, array $languageFilter = []): SearchResultAdapter { if ($query instanceof LocationQuery) { $searchResults = $this->searchService->findLocations($query, $languageFilter); diff --git a/src/lib/Pagination/Pagerfanta/AdapterFactory/SearchHitAdapterFactoryInterface.php b/src/lib/Pagination/Pagerfanta/AdapterFactory/SearchHitAdapterFactoryInterface.php index 7717cfc618..98d69a24b1 100644 --- a/src/lib/Pagination/Pagerfanta/AdapterFactory/SearchHitAdapterFactoryInterface.php +++ b/src/lib/Pagination/Pagerfanta/AdapterFactory/SearchHitAdapterFactoryInterface.php @@ -9,14 +9,28 @@ namespace Ibexa\Core\Pagination\Pagerfanta\AdapterFactory; use Ibexa\Contracts\Core\Repository\Values\Content\Query; -use Pagerfanta\Adapter\AdapterInterface; +use Ibexa\Core\Pagination\Pagerfanta\SearchResultAdapter; /** * @internal + * + * @phpstan-import-type TSearchLanguageFilter from \Ibexa\Contracts\Core\Repository\SearchService */ interface SearchHitAdapterFactoryInterface { - public function createAdapter(Query $query, array $languageFilter = []): AdapterInterface; + /** + * @phpstan-param TSearchLanguageFilter $languageFilter + * + * @phpstan-return \Ibexa\Core\Pagination\Pagerfanta\SearchResultAdapter<\Ibexa\Contracts\Core\Repository\Values\ValueObject> + */ + public function createAdapter(Query $query, array $languageFilter = []): SearchResultAdapter; - public function createFixedAdapter(Query $query, array $languageFilter = []): AdapterInterface; + /** + * @phpstan-return \Ibexa\Core\Pagination\Pagerfanta\SearchResultAdapter<\Ibexa\Contracts\Core\Repository\Values\ValueObject> + * + * @phpstan-param TSearchLanguageFilter $languageFilter + * + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + */ + public function createFixedAdapter(Query $query, array $languageFilter = []): SearchResultAdapter; }