mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix new phpstan issues
This commit is contained in:
parent
841bdb0ebf
commit
4db1ff405e
@ -113,27 +113,23 @@ class EventSearch extends AbstractSearch
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// format is "json"
|
||||||
|
$results = [];
|
||||||
|
$search = $this->search($terms, $start, $limit, $options);
|
||||||
|
|
||||||
if ('json' === $format) {
|
foreach ($search as $item) {
|
||||||
$results = [];
|
$results[] = [
|
||||||
$search = $this->search($terms, $start, $limit, $options);
|
'id' => $item->getId(),
|
||||||
|
'text' => $item->getDate()->format('d/m/Y, H:i') . ' → ' .
|
||||||
foreach ($search as $item) {
|
// $item->getType()->getName()['fr'] . ': ' . // display the type of event
|
||||||
$results[] = [
|
$item->getName(),
|
||||||
'id' => $item->getId(),
|
|
||||||
'text' => $item->getDate()->format('d/m/Y, H:i') . ' → ' .
|
|
||||||
// $item->getType()->getName()['fr'] . ': ' . // display the type of event
|
|
||||||
$item->getName(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
|
||||||
'results' => $results,
|
|
||||||
'pagination' => [
|
|
||||||
'more' => $paginator->hasNextPage(),
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'results' => $results,
|
||||||
|
'more' => $paginator->hasNextPage(),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supports($domain, $format)
|
public function supports($domain, $format)
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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 = [];
|
||||||
|
|
||||||
|
@ -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');
|
||||||
|
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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,15 +227,13 @@ 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' => [
|
'more' => $paginator->hasNextPage(),
|
||||||
'more' => $paginator->hasNextPage(),
|
],
|
||||||
],
|
];
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supports($domain, $format)
|
public function supports($domain, $format)
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user