Your project controllers should only contains actions as public methods 12

More information: https://insight.symfony.com/what-we-analyse/symfony.controller.non_action_public_method_in_controller_class

  1. $entityInstance->setPassword($password);
  2. }
  3. parent::updateEntity($entityManager, $entityInstance);
  4. }
  5. public function impersonate(AdminContext $context): RedirectResponse

    Non-action public method found in controller class

    Time to fix: about 1 hour
    Read doc Permalink
    Last edited by Damien Lagae
  6. {
  7. if (!$this->isGranted('ROLE_ALLOWED_TO_SWITCH')) {
  8. throw new HttpException(Response::HTTP_UNAUTHORIZED);
  9. }
  • damienlagae

    ok for now
  1. }
  2. /**
  3. * @return iterable<FieldInterface>
  4. */
  5. public function configureFields(string $pageName): iterable

    Non-action public method found in controller class

    Time to fix: about 1 hour
    Read doc Permalink
    Last edited by Damien Lagae
  6. {
  7. /** @var User $currentUser */
  8. $currentUser = $this->getUser();
  9. /** @var AdminContext $context */
  10. $context = $this->adminContextProvider->getContext();
  • damienlagae

    ok for now
  1. }
  2. return new RedirectResponse($referer);
  3. }
  4. public function restoreUser(AdminContext $context): Response

    Non-action public method found in controller class

    Time to fix: about 1 hour
    Read doc Permalink
    Last edited by Damien Lagae
  5. {
  6. if (!$this->isGranted('ROLE_SUPER_ADMIN')) {
  7. throw new HttpException(Response::HTTP_UNAUTHORIZED);
  8. }
  • damienlagae

    ok for now
  1. /**
  2. * @param EntityManagerInterface $entityManager
  3. * @param User $entityInstance
  4. */
  5. public function updateEntity(EntityManagerInterface $entityManager, $entityInstance): void

    Non-action public method found in controller class

    Time to fix: about 1 hour
    Read doc Permalink
    Last edited by Damien Lagae
  6. {
  7. /** @var UserPasswordHasherInterface $hasher */
  8. $hasher = $this->container->get('security.password_hasher');
  9. $plainPassword = $entityInstance->getPlainPassword();
  10. if ($plainPassword !== null) {
  • damienlagae

    ok for now
  1. ->setSearchFields(['id', 'email', 'displayName'])
  2. ->setEntityPermission(User::ADMIN)
  3. ;
  4. }
  5. public function configureActions(Actions $actions): Actions

    Non-action public method found in controller class

    Time to fix: about 1 hour
    Read doc Permalink
    Last edited by Damien Lagae
  6. {
  7. $actions = parent::configureActions($actions);
  8. /** @var User $currentUser */
  9. $currentUser = $this->getUser();
  • damienlagae

    ok for now
  1. );
  2. return parent::configureFilters($filters);
  3. }
  4. public function configureCrud(Crud $crud): Crud

    Non-action public method found in controller class

    Time to fix: about 1 hour
    Read doc Permalink
    Last edited by Damien Lagae
  5. {
  6. return $crud
  7. ->setPageTitle(Crud::PAGE_INDEX, 'enabel_user.admin.title.manage_users')
  8. ->setPageTitle(Crud::PAGE_NEW, 'enabel_user.admin.title.new_user')
  9. ->setPageTitle(Crud::PAGE_EDIT, 'enabel_user.admin.title.edit_user')
  • damienlagae

    ok for now
  1. $entityManager->getFilters()->disable('softdeleteable');
  2. // @codeCoverageIgnoreEnd
  3. }
  4. }
  5. public function configureFilters(Filters $filters): Filters

    Non-action public method found in controller class

    Time to fix: about 1 hour
    Read doc Permalink
    Last edited by Damien Lagae
  6. {
  7. $filters->add(
  8. SoftDeleteFilter::new(
  9. 'deletedAt',
  10. $this->translator->trans('enabel_user.admin.form.showDeleted')
  • damienlagae

    ok for now
  1. /**
  2. * @param EntityManagerInterface $entityManager
  3. * @param User $entityInstance
  4. */
  5. public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void

    Non-action public method found in controller class

    Time to fix: about 1 hour
    Read doc Permalink
    Last edited by Damien Lagae
  6. {
  7. /** @var UserPasswordHasherInterface $hasher */
  8. $hasher = $this->container->get('security.password_hasher');
  9. $plainPassword = $entityInstance->getPlainPassword();
  10. if ($plainPassword !== null) {
  • damienlagae

    ok for now
  1. []
  2. );
  3. }
  4. /** @codeCoverageIgnore */
  5. #[Route(path: '/azure/check', name: 'enabel_azure_check')]

    Non-action public method found in controller class

    Time to fix: about 1 hour
    Read doc Permalink
    Last edited by Damien Lagae
  6. public function azureCheck(): void
  7. {
  8. throw new \LogicException('This method can be blank - Intercepted by the oauth2 client');
  9. }
  10. }
  • damienlagae

    ok for now
  1. use Symfony\Component\HttpFoundation\RedirectResponse;
  2. use Symfony\Component\Routing\Annotation\Route;
  3. class AzureController extends AbstractController
  4. {
  5. #[Route(path: '/azure/login', name: 'enabel_azure_login')]

    Non-action public method found in controller class

    Time to fix: about 1 hour
    Read doc Permalink
    Last edited by Damien Lagae
  6. public function azureLogin(ClientRegistry $clientRegistry): RedirectResponse
  7. {
  8. return $clientRegistry
  9. ->getClient('azure_o365')
  10. ->redirect(
  • damienlagae

    ok for now
  1. }
  2. /**
  3. * @return never
  4. */
  5. #[Route(path: '/auth/logout', name: 'enabel_logout')]

    Non-action public method found in controller class

    Time to fix: about 1 hour
    Read doc Permalink
    Last edited by Damien Lagae
  6. public function logout(): Response
  7. {
  8. throw new \LogicException('This method can be blank - Intercepted by the logout key on your firewall.');
  9. }
  10. }
  • damienlagae

    ok for now
  1. use Symfony\Component\Routing\Annotation\Route;
  2. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  3. class LocalController extends AbstractController
  4. {
  5. #[Route(path: '/auth/login', name: 'enabel_login')]

    Non-action public method found in controller class

    Time to fix: about 1 hour
    Read doc Permalink
    Last edited by Damien Lagae
  6. public function login(AuthenticationUtils $authenticationUtils, ParameterBagInterface $parameterBag): Response
  7. {
  8. if (null !== $this->getUser()) {
  9. /** @var string $defaultTarget */
  10. $defaultTarget = $parameterBag->get('enabel_user.login_redirect_route');
  • damienlagae

    ok for now