Improve return types for methods

This commit is contained in:
2025-11-04 09:56:04 +01:00
parent a113360ccf
commit 8f20570f3b
5 changed files with 8 additions and 14 deletions

View File

@@ -237,7 +237,7 @@ class CustomFieldsGroupController extends AbstractController
]); ]);
} }
private function createCreateFieldForm(CustomFieldsGroup $customFieldsGroup) private function createCreateFieldForm(CustomFieldsGroup $customFieldsGroup): \Symfony\Component\Form\FormInterface
{ {
$fieldChoices = []; $fieldChoices = [];

View File

@@ -177,7 +177,7 @@ class EventSearch extends AbstractSearch
return $qb; return $qb;
} }
protected function count(array $terms) protected function count(array $terms): mixed
{ {
$qb = $this->eventRepository->createQueryBuilder('e'); $qb = $this->eventRepository->createQueryBuilder('e');
$qb->select('COUNT(e)'); $qb->select('COUNT(e)');
@@ -191,7 +191,7 @@ class EventSearch extends AbstractSearch
return ['date-from', 'date-to', 'name', 'date']; return ['date-from', 'date-to', 'name', 'date'];
} }
protected function search(array $terms, $start, $limit, $options) protected function search(array $terms, $start, $limit, $options): mixed
{ {
$qb = $this->eventRepository->createQueryBuilder('e'); $qb = $this->eventRepository->createQueryBuilder('e');
$qb->select('e'); $qb->select('e');

View File

@@ -207,7 +207,7 @@ class SearchController extends AbstractController
return $this->json($collection, \Symfony\Component\HttpFoundation\Response::HTTP_OK, [], ['groups' => ['read']]); return $this->json($collection, \Symfony\Component\HttpFoundation\Response::HTTP_OK, [], ['groups' => ['read']]);
} }
protected function createAdvancedSearchForm($name, array $data = []) protected function createAdvancedSearchForm($name, array $data = []): \Symfony\Component\Form\FormInterface
{ {
$builder = $this->formFactory $builder = $this->formFactory
->createNamedBuilder( ->createNamedBuilder(

View File

@@ -313,12 +313,12 @@ class CSVFormatter implements FormatterInterface
return $text; return $text;
} }
protected function getColumnHeaders() protected function getColumnHeaders(): array
{ {
return $this->getPositionnalHeaders('c'); return $this->getPositionnalHeaders('c');
} }
protected function getRowHeaders() protected function getRowHeaders(): array
{ {
return $this->getPositionnalHeaders('r'); return $this->getPositionnalHeaders('r');
} }

View File

@@ -23,7 +23,7 @@ use Twig\TwigFunction;
* *
* The logic of the function is based on the original routing extension. * The logic of the function is based on the original routing extension.
*/ */
class ChillTwigRoutingHelper extends AbstractExtension class ChillTwigRoutingHelper
{ {
/** /**
* @var RoutingExtension * @var RoutingExtension
@@ -75,6 +75,7 @@ class ChillTwigRoutingHelper extends AbstractExtension
return $this->originalExtension->getPath($name, $params, $relative); return $this->originalExtension->getPath($name, $params, $relative);
} }
#[\Twig\Attribute\AsTwigFilter('chill_return_path_label')]
public function getLabelReturnPath($default) public function getLabelReturnPath($default)
{ {
$request = $this->requestStack->getCurrentRequest(); $request = $this->requestStack->getCurrentRequest();
@@ -150,11 +151,4 @@ class ChillTwigRoutingHelper extends AbstractExtension
{ {
return $this->originalExtension->isUrlGenerationSafe($argsNode); return $this->originalExtension->isUrlGenerationSafe($argsNode);
} }
public function getFilters(): array
{
return [
new TwigFilter('chill_return_path_label', $this->getLabelReturnPath(...)),
];
}
} }