PSR 2 compliance

This commit is contained in:
Simon Vieille 2021-03-17 17:17:52 +01:00
parent 7497232a5a
commit a7dc9a6189
3 changed files with 10 additions and 14 deletions

View file

@ -4,19 +4,18 @@ namespace App\Controller\User;
use App\Controller\Admin\AdminController;
use App\Entity\User as Entity;
use App\Event\Account\PasswordRequestEvent;
use App\Factory\UserFactory as EntityFactory;
use App\Form\UserType as EntityType;
use App\Manager\EntityManager;
use App\Repository\UserRepositoryQuery;
use App\Repository\Blog\PostRepositoryQuery;
use App\Repository\UserRepositoryQuery as RepositoryQuery;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use App\Repository\Blog\PostRepositoryQuery;
use Symfony\Component\Security\Csrf\TokenGenerator\TokenGeneratorInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use App\Event\Account\PasswordRequestEvent;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Security\Csrf\TokenGenerator\TokenGeneratorInterface;
/**
* @Route("/admin/user")
@ -43,8 +42,7 @@ class UserAdminController extends AdminController
EntityManager $entityManager,
UserPasswordEncoderInterface $encoder,
Request $request
): Response
{
): Response {
$entity = $factory->create($this->getUser());
$form = $this->createForm(EntityType::class, $entity);
@ -122,8 +120,7 @@ class UserAdminController extends AdminController
TokenGeneratorInterface $tokenGenerator,
EventDispatcherInterface $eventDispatcher,
Request $request
): Response
{
): Response {
if ($this->isCsrfTokenValid('resetting_request'.$entity->getId(), $request->request->get('_token'))) {
$entity->setConfirmationToken($tokenGenerator->generateToken());
$entity->setPasswordRequestedAt(new \DateTime('now'));

View file

@ -4,12 +4,12 @@ namespace App\Form;
use App\Entity\User;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
class UserType extends AbstractType
{
@ -80,7 +80,6 @@ class UserType extends AbstractType
],
]
);
}
public function configureOptions(OptionsResolver $resolver)

View file

@ -3,9 +3,9 @@
namespace App\Repository\Blog;
use App\Entity\Blog\Category;
use App\Entity\User;
use App\Repository\RepositoryQuery;
use Knp\Component\Pager\PaginatorInterface;
use App\Entity\User;
/**
* class PostRepositoryQuery.