diff --git a/docs/source/_static/code/exports/CountPerson.php b/docs/source/_static/code/exports/CountPerson.php index 48eab8a55..afe19c73b 100644 --- a/docs/source/_static/code/exports/CountPerson.php +++ b/docs/source/_static/code/exports/CountPerson.php @@ -90,9 +90,7 @@ class CountPerson implements ExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { // we gather all center the user choose. - $centers = array_map(static function ($el) { - return $el['center']; - }, $acl); + $centers = array_map(static fn($el) => $el['center'], $acl); $qb = $this->entityManager->createQueryBuilder(); diff --git a/src/Bundle/ChillMainBundle/Form/AdvancedSearchType.php b/src/Bundle/ChillMainBundle/Form/AdvancedSearchType.php deleted file mode 100644 index 9157e8023..000000000 --- a/src/Bundle/ChillMainBundle/Form/AdvancedSearchType.php +++ /dev/null @@ -1,44 +0,0 @@ -searchProvider = $searchProvider; - } - - public function buildForm(FormBuilderInterface $builder, array $options) - { - $this->searchProvider - ->getHasAdvancedFormByName($options['search_service']) - ->createSearchForm($builder); - } - - public function configureOptions(OptionsResolver $resolver) - { - $resolver - ->setRequired('search_service') - ->setAllowedTypes('search_service', ['string']); - } -} diff --git a/src/Bundle/ChillMainBundle/Search/HasAdvancedSearchFormInterface.php b/src/Bundle/ChillMainBundle/Search/HasAdvancedSearchFormInterface.php index e5f103cdf..7aaf31bb3 100644 --- a/src/Bundle/ChillMainBundle/Search/HasAdvancedSearchFormInterface.php +++ b/src/Bundle/ChillMainBundle/Search/HasAdvancedSearchFormInterface.php @@ -20,4 +20,6 @@ interface HasAdvancedSearchFormInterface extends SearchInterface public function convertFormDataToQuery(array $data); public function convertTermsToFormData(array $terms); + + public function getAdvancedSearchTitle(): string; } diff --git a/src/Bundle/ChillMainBundle/Search/SearchProvider.php b/src/Bundle/ChillMainBundle/Search/SearchProvider.php index a629a45d2..a6b17133f 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchProvider.php +++ b/src/Bundle/ChillMainBundle/Search/SearchProvider.php @@ -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(); }); diff --git a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php index 7cd1849a3..dabc79475 100644 --- a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php +++ b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php @@ -173,7 +173,7 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf return $data; } - public function getAdvancedSearchTitle() + public function getAdvancedSearchTitle(): string { return 'Search within persons'; }