Rector changes and immplementations of required methods

This commit is contained in:
2025-05-22 17:47:07 +02:00
parent 053b92b77c
commit 17db59d221
1138 changed files with 2656 additions and 2616 deletions

View File

@@ -22,7 +22,7 @@ class AbsenceController extends AbstractController
public function __construct(private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
#[Route(path: '/{_locale}/absence', name: 'chill_main_user_absence_index', methods: ['GET', 'POST'])]
public function setAbsence(Request $request)
public function setAbsence(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$user = $this->security->getUser();
$form = $this->createForm(AbsenceType::class, $user);
@@ -43,7 +43,7 @@ class AbsenceController extends AbstractController
}
#[Route(path: '/{_locale}/absence/unset', name: 'chill_main_user_absence_unset', methods: ['GET', 'POST'])]
public function unsetAbsence(Request $request)
public function unsetAbsence(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse
{
$user = $this->security->getUser();

View File

@@ -17,31 +17,31 @@ use Symfony\Component\Routing\Annotation\Route;
class AdminController extends AbstractController
{
#[Route(path: '/{_locale}/admin', name: 'chill_main_admin_central')]
public function indexAction()
public function indexAction(): \Symfony\Component\HttpFoundation\Response
{
return $this->render('@ChillMain/Admin/index.html.twig');
}
#[Route(path: '/{_locale}/admin/language', name: 'chill_main_language_admin')]
public function indexLanguageAction()
public function indexLanguageAction(): \Symfony\Component\HttpFoundation\Response
{
return $this->render('@ChillMain/Admin/indexLanguage.html.twig');
}
#[Route(path: '/{_locale}/admin/location', name: 'chill_main_location_admin')]
public function indexLocationAction()
public function indexLocationAction(): \Symfony\Component\HttpFoundation\Response
{
return $this->render('@ChillMain/Admin/indexLocation.html.twig');
}
#[Route(path: '/{_locale}/admin/user', name: 'chill_main_user_admin')]
public function indexUserAction()
public function indexUserAction(): \Symfony\Component\HttpFoundation\Response
{
return $this->render('@ChillMain/Admin/indexUser.html.twig');
}
#[Route(path: '/{_locale}/admin/dashboard', name: 'chill_main_dashboard_admin')]
public function indexDashboardAction()
public function indexDashboardAction(): \Symfony\Component\HttpFoundation\Response
{
return $this->render('@ChillMain/Admin/indexDashboard.html.twig');
}

View File

@@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class DefaultController extends AbstractController
{
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/homepage', name: 'chill_main_homepage')]
public function indexAction()
public function indexAction(): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
if ($this->isGranted('ROLE_ADMIN')) {
return $this->redirectToRoute('chill_main_admin_central', [], 302);
@@ -29,12 +29,12 @@ class DefaultController extends AbstractController
}
#[\Symfony\Component\Routing\Annotation\Route(path: '/homepage', name: 'chill_main_homepage_without_locale')]
public function indexWithoutLocaleAction()
public function indexWithoutLocaleAction(): \Symfony\Component\HttpFoundation\RedirectResponse
{
return $this->redirectToRoute('chill_main_homepage');
}
public function testAction()
public function testAction(): \Symfony\Component\HttpFoundation\Response
{
return $this->render('@ChillMain/Tabs/index.html.twig', [
'tabs' => [

View File

@@ -66,7 +66,7 @@ class ExportController extends AbstractController
}
#[Route(path: '/{_locale}/exports/download/{alias}', name: 'chill_main_export_download', methods: ['GET'])]
public function downloadResultAction(Request $request, mixed $alias)
public function downloadResultAction(Request $request, mixed $alias): \Symfony\Component\HttpFoundation\Response
{
/** @var ExportManager $exportManager */
$exportManager = $this->exportManager;
@@ -434,7 +434,7 @@ class ExportController extends AbstractController
*
* @return RedirectResponse
*/
private function forwardToGenerate(Request $request, DirectExportInterface|ExportInterface $export, $alias, ?SavedExport $savedExport)
private function forwardToGenerate(Request $request, DirectExportInterface|ExportInterface $export, $alias, ?SavedExport $savedExport): \Symfony\Component\HttpFoundation\RedirectResponse
{
$dataCenters = $this->session->get('centers_step_raw', null);
$dataFormatter = $this->session->get('formatter_step_raw', null);
@@ -509,7 +509,7 @@ class ExportController extends AbstractController
*
* @return Response
*/
private function selectCentersStep(Request $request, DirectExportInterface|ExportInterface $export, $alias, ?SavedExport $savedExport = null)
private function selectCentersStep(Request $request, DirectExportInterface|ExportInterface $export, $alias, ?SavedExport $savedExport = null): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
if (!$this->filterStatsByCenters) {
return $this->redirectToRoute('chill_main_export_new', [

View File

@@ -18,7 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
*/
class MenuController extends AbstractController
{
public function writeMenuAction($menu, $layout, $activeRouteKey = null, array $args = [])
public function writeMenuAction($menu, $layout, $activeRouteKey = null, array $args = []): \Symfony\Component\HttpFoundation\Response
{
return $this->render($layout, [
'menu_composer' => $this->get('chill.main.menu_composer'),

View File

@@ -95,9 +95,7 @@ class NotificationApiController
return new JsonResponse(null, JsonResponse::HTTP_ACCEPTED, [], false);
}
/**
* @Route("/mark/allread", name="chill_api_main_notification_mark_allread", methods={"POST"})
*/
#[Route(path: '/mark/allread', name: 'chill_api_main_notification_mark_allread', methods: ['POST'])]
public function markAllRead(): JsonResponse
{
$user = $this->security->getUser();
@@ -111,9 +109,7 @@ class NotificationApiController
return new JsonResponse($modifiedNotificationIds);
}
/**
* @Route("/mark/undoallread", name="chill_api_main_notification_mark_undoallread", methods={"POST"})
*/
#[Route(path: '/mark/undoallread', name: 'chill_api_main_notification_mark_undoallread', methods: ['POST'])]
public function undoAllRead(Request $request): JsonResponse
{
$user = $this->security->getUser();

View File

@@ -45,7 +45,7 @@ final class PasswordController extends AbstractController
* @return Response
*/
#[Route(path: '/public/{_locale}/password/request-changed', name: 'password_request_recover_changed')]
public function changeConfirmedAction()
public function changeConfirmedAction(): \Symfony\Component\HttpFoundation\Response
{
return $this->render('@ChillMain/Password/recover_password_changed.html.twig');
}
@@ -190,7 +190,7 @@ final class PasswordController extends AbstractController
* @return Response
*/
#[Route(path: '/public/{_locale}/password/request-confirm', name: 'password_request_recover_confirm')]
public function requestRecoverConfirmAction()
public function requestRecoverConfirmAction(): \Symfony\Component\HttpFoundation\Response
{
return $this->render('@ChillMain/Password/request_recover_password_confirm.html.twig');
}
@@ -199,7 +199,7 @@ final class PasswordController extends AbstractController
* @return Response
*/
#[Route(path: '/{_locale}/my/password', name: 'change_my_password')]
public function UserPasswordAction(Request $request)
public function UserPasswordAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
if (!$this->security->isGranted('ROLE_USER')) {
throw new AccessDeniedHttpException();
@@ -246,7 +246,7 @@ final class PasswordController extends AbstractController
/**
* @return \Symfony\Component\Form\FormInterface
*/
protected function requestRecoverForm()
protected function requestRecoverForm(): \Symfony\Component\Form\FormInterface
{
$builder = $this->createFormBuilder();
$builder
@@ -280,7 +280,7 @@ final class PasswordController extends AbstractController
/**
* @return \Symfony\Component\Form\FormInterface
*/
private function passwordForm(User $user)
private function passwordForm(User $user): \Symfony\Component\Form\FormInterface
{
return $this
->createForm(

View File

@@ -34,7 +34,7 @@ class ScopeController extends AbstractController
* Creates a new Scope entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/create', name: 'admin_scope_create', methods: ['POST'])]
public function createAction(Request $request)
public function createAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$scope = new Scope();
$form = $this->createCreateForm($scope);
@@ -79,7 +79,7 @@ class ScopeController extends AbstractController
* Lists all Scope entities.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/', name: 'admin_scope')]
public function indexAction()
public function indexAction(): \Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
@@ -94,7 +94,7 @@ class ScopeController extends AbstractController
* Displays a form to create a new Scope entity.
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/new', name: 'admin_scope_new')]
public function newAction()
public function newAction(): \Symfony\Component\HttpFoundation\Response
{
$scope = new Scope();
$form = $this->createCreateForm($scope);
@@ -108,7 +108,7 @@ class ScopeController extends AbstractController
/**
* Finds and displays a Scope entity.
*/
public function showAction(mixed $id)
public function showAction(mixed $id): \Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();

View File

@@ -35,7 +35,7 @@ class SearchController extends AbstractController
public function __construct(protected SearchProvider $searchProvider, protected TranslatorInterface $translator, protected PaginatorFactory $paginatorFactory, protected SearchApi $searchApi) {}
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search/advanced/{name}', name: 'chill_main_advanced_search')]
public function advancedSearchAction(mixed $name, Request $request)
public function advancedSearchAction(mixed $name, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
try {
/** @var Chill\MainBundle\Search\SearchProvider $variable */
@@ -80,7 +80,7 @@ class SearchController extends AbstractController
}
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search/advanced', name: 'chill_main_advanced_search_list')]
public function advancedSearchListAction(Request $request)
public function advancedSearchListAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
/** @var Chill\MainBundle\Search\SearchProvider $variable */
$searchProvider = $this->searchProvider;

View File

@@ -23,7 +23,7 @@ class TimelineCenterController extends AbstractController
public function __construct(protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly Security $security) {}
#[Route(path: '/{_locale}/center/timeline', name: 'chill_center_timeline', methods: ['GET'])]
public function centerAction(Request $request)
public function centerAction(Request $request): \Symfony\Component\HttpFoundation\Response
{
// collect reachable center for each group
$user = $this->security->getUser();

View File

@@ -21,7 +21,7 @@ class UIController extends AbstractController
{
public function showNotificationUserCounterAction(
CountNotificationUser $counter,
) {
): \Symfony\Component\HttpFoundation\Response {
$nb = $counter->getSumNotification($this->getUser());
return $this->render('@ChillMain/UI/notification_user_counter.html.twig', [

View File

@@ -203,7 +203,7 @@ class UserController extends CRUDController
* Displays a form to edit the user current location.
*/
#[Route(path: '/{_locale}/main/user/current-location/edit', name: 'chill_main_user_currentlocation_edit')]
public function editCurrentLocationAction(Request $request)
public function editCurrentLocationAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$user = $this->security->getUser();
$form = $this->createForm(UserCurrentLocationType::class, $user)
@@ -234,7 +234,7 @@ class UserController extends CRUDController
* Displays a form to edit the user password.
*/
#[Route(path: '/{_locale}/admin/user/{id}/edit_password', name: 'admin_user_edit_password')]
public function editPasswordAction(User $user, Request $request)
public function editPasswordAction(User $user, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$editForm = $this->createEditPasswordForm($user);
$editForm->handleRequest($request);
@@ -244,7 +244,7 @@ class UserController extends CRUDController
// logging for prod
$this->logger->info('update password for an user', [
'by' => $this->getUser()->getUsername(),
'by' => $this->getUser()->getUserIdentifier(),
'user' => $user->getUsername(),
]);

View File

@@ -34,7 +34,7 @@ final class UserProfileController extends AbstractController
* User profile that allows editing of phonenumber and visualization of certain data.
*/
#[Route(path: '/{_locale}/main/user/my-profile', name: 'chill_main_user_profile')]
public function __invoke(Request $request)
public function __invoke(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
if (!$this->security->isGranted('ROLE_USER')) {
throw new AccessDeniedHttpException();