DX: fix typing in SearchProvider

This commit is contained in:
2023-04-15 00:33:31 +02:00
parent 459b91001f
commit a9db133a7b
5 changed files with 7 additions and 55 deletions

View File

@@ -20,4 +20,6 @@ interface HasAdvancedSearchFormInterface extends SearchInterface
public function convertFormDataToQuery(array $data);
public function convertTermsToFormData(array $terms);
public function getAdvancedSearchTitle(): string;
}

View File

@@ -33,7 +33,7 @@ use function count;
class SearchProvider
{
/**
* @var HasAdvancedSearchForm[]
* @var HasAdvancedSearchFormInterface[]
*/
private $hasAdvancedFormSearchServices = [];
@@ -101,13 +101,9 @@ class SearchProvider
* return searchservice with an advanced form, defined in service
* definition.
*
* @param string $name
*
* @throws UnknowSearchNameException
*
* @return HasAdvancedSearchForm
*/
public function getHasAdvancedFormByName($name)
public function getHasAdvancedFormByName(string $name): HasAdvancedSearchFormInterface
{
if (array_key_exists($name, $this->hasAdvancedFormSearchServices)) {
return $this->hasAdvancedFormSearchServices[$name];
@@ -119,7 +115,7 @@ class SearchProvider
public function getHasAdvancedFormSearchServices()
{
//sort the array
uasort($this->hasAdvancedFormSearchServices, static function (SearchInterface $a, SearchInterface $b) {
uasort($this->hasAdvancedFormSearchServices, static function (HasAdvancedSearchFormInterface $a, HasAdvancedSearchFormInterface $b): int {
return $a->getOrder() <=> $b->getOrder();
});