phpstan level 3, fixed deprecations, code cleanup (#811)
This commit is contained in:
@@ -9,11 +9,12 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Timesheet;
|
||||
use App\Entity\User;
|
||||
use App\Form\Toolbar\UserToolbarForm;
|
||||
use App\Form\UserCreateType;
|
||||
use App\Repository\Query\UserQuery;
|
||||
use App\Repository\TimesheetRepository;
|
||||
use App\Repository\UserRepository;
|
||||
use App\Security\RolePermissionManager;
|
||||
use Pagerfanta\Pagerfanta;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||
@@ -33,21 +34,23 @@ class UserController extends AbstractController
|
||||
* @var UserPasswordEncoderInterface
|
||||
*/
|
||||
protected $encoder;
|
||||
|
||||
/**
|
||||
* @param UserPasswordEncoderInterface $encoder
|
||||
* @var UserRepository
|
||||
*/
|
||||
public function __construct(UserPasswordEncoderInterface $encoder)
|
||||
protected $repository;
|
||||
|
||||
public function __construct(UserPasswordEncoderInterface $encoder, UserRepository $repository)
|
||||
{
|
||||
$this->encoder = $encoder;
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \App\Repository\UserRepository
|
||||
* @return UserRepository
|
||||
*/
|
||||
protected function getRepository()
|
||||
{
|
||||
return $this->getDoctrine()->getRepository(User::class);
|
||||
return $this->repository;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,13 +136,14 @@ class UserController extends AbstractController
|
||||
*
|
||||
* @param User $userToDelete
|
||||
* @param Request $request
|
||||
* @param TimesheetRepository $repository
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
*/
|
||||
public function deleteAction(User $userToDelete, Request $request)
|
||||
public function deleteAction(User $userToDelete, Request $request, TimesheetRepository $repository)
|
||||
{
|
||||
// $userToDelete MUST not be called $user, as $user is always the current user!
|
||||
$stats = $this->getDoctrine()->getRepository(Timesheet::class)->getUserStatistics($userToDelete);
|
||||
$stats = $repository->getUserStatistics($userToDelete);
|
||||
|
||||
$deleteForm = $this->createFormBuilder(null, [
|
||||
'attr' => [
|
||||
|
||||
Reference in New Issue
Block a user