diff --git a/src/Action/RequestResetAction.php b/src/Action/RequestResetAction.php index fc67c378..75546b11 100644 --- a/src/Action/RequestResetAction.php +++ b/src/Action/RequestResetAction.php @@ -190,6 +190,9 @@ private function getFlashBag(Request $request): ?FlashBagInterface return $session->getFlashBag(); } + /** + * @return FormInterface + */ private function createForm(): FormInterface { return $this->formFactory diff --git a/src/Action/UpdateSecurityAction.php b/src/Action/UpdateSecurityAction.php index 94fd8ab0..948522bc 100644 --- a/src/Action/UpdateSecurityAction.php +++ b/src/Action/UpdateSecurityAction.php @@ -107,6 +107,9 @@ public function __invoke(Request $request): Response ])); } + /** + * @return FormInterface + */ private function createForm(UserInterface $model): FormInterface { return $this->formFactory diff --git a/src/Event/FormEvent.php b/src/Event/FormEvent.php index da48adfb..292cc84c 100644 --- a/src/Event/FormEvent.php +++ b/src/Event/FormEvent.php @@ -16,20 +16,32 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Contracts\EventDispatcher\Event; +/** + * @template T + */ class FormEvent extends Event { + /** + * @var FormInterface + */ private readonly FormInterface $form; private readonly Request $request; private ?Response $response = null; + /** + * @param FormInterface $form + */ public function __construct(FormInterface $form, Request $request) { $this->form = $form; $this->request = $request; } + /** + * @return FormInterface + */ public function getForm(): FormInterface { return $this->form; diff --git a/src/EventListener/ResettingListener.php b/src/EventListener/ResettingListener.php index cf1c877f..ae47ae02 100644 --- a/src/EventListener/ResettingListener.php +++ b/src/EventListener/ResettingListener.php @@ -47,14 +47,13 @@ public function onResettingResetInitialize(GetResponseUserEvent $event): void } } + /** + * @param FormEvent $event + */ public function onResettingResetSuccess(FormEvent $event): void { $model = $event->getForm()->getData(); - if (!$model instanceof Resetting) { - return; - } - $user = $model->getUser(); $user->setConfirmationToken(null); diff --git a/src/Form/Type/AccountDeletionFormType.php b/src/Form/Type/AccountDeletionFormType.php index 4c0fd0fd..31eb1fe6 100644 --- a/src/Form/Type/AccountDeletionFormType.php +++ b/src/Form/Type/AccountDeletionFormType.php @@ -20,6 +20,9 @@ use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; use Symfony\Component\Validator\Constraints\NotBlank; +/** + * @extends AbstractType + */ final class AccountDeletionFormType extends AbstractType { /** diff --git a/src/Form/Type/LoginFormType.php b/src/Form/Type/LoginFormType.php index 0366f992..9fed12a4 100644 --- a/src/Form/Type/LoginFormType.php +++ b/src/Form/Type/LoginFormType.php @@ -21,6 +21,9 @@ use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; use Symfony\Contracts\Translation\TranslatorInterface; +/** + * @extends AbstractType + */ final class LoginFormType extends AbstractType { private readonly AuthenticationUtils $authenticationUtils; diff --git a/src/Form/Type/RequestPasswordFormType.php b/src/Form/Type/RequestPasswordFormType.php index b70ee20c..c063196e 100644 --- a/src/Form/Type/RequestPasswordFormType.php +++ b/src/Form/Type/RequestPasswordFormType.php @@ -14,6 +14,9 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +/** + * @extends AbstractType + */ final class RequestPasswordFormType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/Form/Type/ResettingFormType.php b/src/Form/Type/ResettingFormType.php index 697b108c..e4f9b285 100644 --- a/src/Form/Type/ResettingFormType.php +++ b/src/Form/Type/ResettingFormType.php @@ -18,6 +18,9 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +/** + * @extends AbstractType + */ final class ResettingFormType extends AbstractType { /** diff --git a/src/Form/Type/UpdateSecurityFormType.php b/src/Form/Type/UpdateSecurityFormType.php index 26245016..5aa9add4 100644 --- a/src/Form/Type/UpdateSecurityFormType.php +++ b/src/Form/Type/UpdateSecurityFormType.php @@ -20,6 +20,9 @@ use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; use Symfony\Component\Validator\Constraints\NotBlank; +/** + * @extends AbstractType + */ final class UpdateSecurityFormType extends AbstractType { /** diff --git a/tests/App/Entity/TestUser.php b/tests/App/Entity/TestUser.php index ef28af1d..40552844 100644 --- a/tests/App/Entity/TestUser.php +++ b/tests/App/Entity/TestUser.php @@ -15,11 +15,10 @@ use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; -use Nucleos\UserBundle\Model\GroupInterface; use Nucleos\UserBundle\Model\User; /** - * @phpstan-extends User + * @phpstan-extends User */ #[ORM\Entity] #[ORM\Table(name: 'user__user')] @@ -31,11 +30,12 @@ class TestUser extends User protected int $id; /** - * @var Collection + * @var Collection */ #[ORM\ManyToMany(targetEntity: TestGroup::class)] #[ORM\JoinTable(name: 'user__user_group')] protected Collection $groups; + private static int $index = 1; public function __construct()