fix new phpstan issues

This commit is contained in:
Julien Fastré 2023-04-11 13:04:08 +02:00
parent 841bdb0ebf
commit 4db1ff405e
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
7 changed files with 29 additions and 44 deletions

View File

@ -113,8 +113,7 @@ class EventSearch extends AbstractSearch
] ]
); );
} }
// format is "json"
if ('json' === $format) {
$results = []; $results = [];
$search = $this->search($terms, $start, $limit, $options); $search = $this->search($terms, $start, $limit, $options);
@ -129,12 +128,9 @@ class EventSearch extends AbstractSearch
return [ return [
'results' => $results, 'results' => $results,
'pagination' => [
'more' => $paginator->hasNextPage(), 'more' => $paginator->hasNextPage(),
],
]; ];
} }
}
public function supports($domain, $format) public function supports($domain, $format)
{ {

View File

@ -211,7 +211,7 @@ trait AddWidgetConfigurationTrait
* *
* @throws InvalidConfigurationException if a service's tag does not have the "alias" key * @throws InvalidConfigurationException if a service's tag does not have the "alias" key
* *
* @return type * @return array
*/ */
protected function getWidgetAliasesbyPlace($place, ContainerBuilder $containerBuilder) protected function getWidgetAliasesbyPlace($place, ContainerBuilder $containerBuilder)
{ {

View File

@ -31,8 +31,6 @@ class MultipleObjectsToIdTransformer implements DataTransformerInterface
* Transforms a string (id) to an object (item). * Transforms a string (id) to an object (item).
* *
* @param mixed $array * @param mixed $array
*
* @return ArrayCollection
*/ */
public function reverseTransform($array) public function reverseTransform($array)
{ {
@ -53,10 +51,8 @@ class MultipleObjectsToIdTransformer implements DataTransformerInterface
* Transforms an object (use) to a string (id). * Transforms an object (use) to a string (id).
* *
* @param array $array * @param array $array
*
* @return ArrayCollection
*/ */
public function transform($array) public function transform($array): array
{ {
$ret = []; $ret = [];

View File

@ -71,9 +71,9 @@ interface SearchInterface
* @param array $terms the string to search * @param array $terms the string to search
* @param int $start the first result (for pagination) * @param int $start the first result (for pagination)
* @param int $limit the number of result (for pagination) * @param int $limit the number of result (for pagination)
* @param string $format The format for result * @param "html"|"json" $format The format for result
* *
* @return string, an HTML string * @return string|array a string if format is html, an array if format is json
*/ */
public function renderResult(array $terms, $start = 0, $limit = 50, array $options = [], $format = 'html'); public function renderResult(array $terms, $start = 0, $limit = 50, array $options = [], $format = 'html');

View File

@ -63,6 +63,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
* *
* @param User $user The user * @param User $user The user
* @param array $centers a list of centers which are going to be filtered * @param array $centers a list of centers which are going to be filtered
* @param mixed $role
*/ */
public function filterReachableCenters(User $user, array $centers, $role): array public function filterReachableCenters(User $user, array $centers, $role): array
{ {

View File

@ -203,15 +203,6 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf
return true; return true;
} }
/**
* (non-PHPdoc).
*
* @see \Chill\MainBundle\Search\SearchInterface::renderResult()
*
* @param mixed $start
* @param mixed $limit
* @param mixed $format
*/
public function renderResult(array $terms, $start = 0, $limit = 50, array $options = [], $format = 'html') public function renderResult(array $terms, $start = 0, $limit = 50, array $options = [], $format = 'html')
{ {
$terms = $this->findAdditionnalInDefault($terms); $terms = $this->findAdditionnalInDefault($terms);
@ -236,8 +227,7 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf
] ]
); );
} }
// format is "json"
if ('json' === $format) {
return [ return [
'results' => $this->search($terms, $start, $limit, array_merge($options, ['simplify' => true])), 'results' => $this->search($terms, $start, $limit, array_merge($options, ['simplify' => true])),
'pagination' => [ 'pagination' => [
@ -245,7 +235,6 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf
], ],
]; ];
} }
}
public function supports($domain, $format) public function supports($domain, $format)
{ {

View File

@ -100,6 +100,9 @@ class ThirdPartySearch implements SearchInterface
'more' => $paginator->hasNextPage(), 'more' => $paginator->hasNextPage(),
]; ];
} }
if ('html' === $format) {
throw new \UnexpectedValueException("format not supported");
}
} }
public function supports($domain, $format): bool public function supports($domain, $format): bool