Skip to content

Commit

Permalink
Add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Oct 1, 2021
1 parent 1f199d6 commit 83fbb0d
Show file tree
Hide file tree
Showing 22 changed files with 83 additions and 261 deletions.
18 changes: 3 additions & 15 deletions src/Action/CheckRegistrationMailAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,12 @@

final class CheckRegistrationMailAction
{
/**
* @var UserManagerInterface
*/
private $userManager;
private UserManagerInterface $userManager;

/**
* @var Environment
*/
private $twig;
private Environment $twig;

/**
* @var RouterInterface
*/
private $router;
private RouterInterface $router;

/**
* CheckRegistrationMailAction constructor.
*/
public function __construct(UserManagerInterface $userManager, Environment $twig, RouterInterface $router)
{
$this->userManager = $userManager;
Expand Down
15 changes: 3 additions & 12 deletions src/Action/ConfirmRegistrationAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,11 @@

final class ConfirmRegistrationAction
{
/**
* @var EventDispatcherInterface
*/
private $eventDispatcher;
private EventDispatcherInterface $eventDispatcher;

/**
* @var UserManagerInterface
*/
private $userManager;
private UserManagerInterface $userManager;

/**
* @var RouterInterface
*/
private $router;
private RouterInterface $router;

public function __construct(
EventDispatcherInterface $eventDispatcher,
Expand Down
47 changes: 13 additions & 34 deletions src/Action/EditProfileAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,40 +32,19 @@

final class EditProfileAction
{
/**
* @var EventDispatcherInterface
*/
private $eventDispatcher;

/**
* @var FormFactoryInterface
*/
private $formFactory;

/**
* @var UserManagerInterface
*/
private $userManager;

/**
* @var Environment
*/
private $twig;

/**
* @var RouterInterface
*/
private $router;

/**
* @var Security
*/
private $security;

/**
* @var string
*/
private $formModel;
private EventDispatcherInterface $eventDispatcher;

private FormFactoryInterface $formFactory;

private UserManagerInterface $userManager;

private Environment $twig;

private RouterInterface $router;

private Security $security;

private string $formModel;

public function __construct(
EventDispatcherInterface $eventDispatcher,
Expand Down
40 changes: 11 additions & 29 deletions src/Action/RegistrationAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,17 @@

final class RegistrationAction
{
/**
* @var EventDispatcherInterface
*/
private $eventDispatcher;

/**
* @var FormFactoryInterface
*/
private $formFactory;

/**
* @var UserManagerInterface
*/
private $userManager;

/**
* @var Environment
*/
private $twig;

/**
* @var RouterInterface
*/
private $router;

/**
* @var string
*/
private $formModel;
private EventDispatcherInterface $eventDispatcher;

private FormFactoryInterface $formFactory;

private UserManagerInterface $userManager;

private Environment $twig;

private RouterInterface $router;

private string $formModel;

public function __construct(
EventDispatcherInterface $eventDispatcher,
Expand Down
15 changes: 3 additions & 12 deletions src/Action/RegistrationConfirmedAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,11 @@

final class RegistrationConfirmedAction
{
/**
* @var Environment
*/
private $twig;
private Environment $twig;

/**
* @var Security
*/
private $security;
private Security $security;

/**
* @var TokenStorageInterface
*/
private $tokenStorage;
private TokenStorageInterface $tokenStorage;

public function __construct(Environment $twig, Security $security, TokenStorageInterface $tokenStorage)
{
Expand Down
12 changes: 3 additions & 9 deletions src/Action/ShowProfileAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@

final class ShowProfileAction
{
/**
* @var Environment
*/
private $twig;

/**
* @var Security
*/
private $security;
private Environment $twig;

private Security $security;

public function __construct(Environment $twig, Security $security)
{
Expand Down
17 changes: 4 additions & 13 deletions src/Event/GetResponseRegistrationEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,19 @@

class GetResponseRegistrationEvent extends Event
{
/**
* @var Request|null
*/
protected $request;
protected ?Request $request;

/**
* @var Registration
*/
protected $registration;
protected Registration $registration;

/**
* @var Response|null
*/
private $response;
private ?Response $response = null;

public function __construct(Registration $user, Request $request = null)
{
$this->registration = $user;
$this->request = $request;
}

public function setResponse(Response $response): void
public function setResponse(?Response $response): void
{
$this->response = $response;
}
Expand Down
6 changes: 2 additions & 4 deletions src/Event/UserFormEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@

final class UserFormEvent extends FormEvent
{
/**
* @var UserInterface
*/
private $user;
private UserInterface $user;

public function __construct(UserInterface $user, FormInterface $form, Request $request)
{
parent::__construct($form, $request);

$this->user = $user;
}

Expand Down
17 changes: 4 additions & 13 deletions src/EventListener/AlreadyLoggedinListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,10 @@

final class AlreadyLoggedinListener implements EventSubscriberInterface
{
/**
* @var Security
*/
private $security;

/**
* @var RouterInterface
*/
private $router;

/**
* AlreadyLoggedinListener constructor.
*/
private Security $security;

private RouterInterface $router;

public function __construct(Security $security, RouterInterface $router)
{
$this->security = $security;
Expand Down
10 changes: 2 additions & 8 deletions src/EventListener/AuthenticationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,9 @@

final class AuthenticationListener implements EventSubscriberInterface
{
/**
* @var LoginManagerInterface
*/
private $loginManager;
private LoginManagerInterface $loginManager;

/**
* @var string
*/
private $firewallName;
private string $firewallName;

public function __construct(LoginManagerInterface $loginManager, string $firewallName)
{
Expand Down
20 changes: 4 additions & 16 deletions src/EventListener/EmailConfirmationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,13 @@

final class EmailConfirmationListener implements EventSubscriberInterface
{
/**
* @var MailerInterface
*/
private $mailer;
private MailerInterface $mailer;

/**
* @var TokenGeneratorInterface
*/
private $tokenGenerator;
private TokenGeneratorInterface $tokenGenerator;

/**
* @var UrlGeneratorInterface
*/
private $router;
private UrlGeneratorInterface $router;

/**
* @var SessionInterface
*/
private $session;
private SessionInterface $session;

public function __construct(
MailerInterface $mailer,
Expand Down
12 changes: 3 additions & 9 deletions src/EventListener/FlashListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,14 @@ final class FlashListener implements EventSubscriberInterface
/**
* @var string[]
*/
private static $successMessages = [
private static array $successMessages = [
NucleosProfileEvents::PROFILE_EDIT_COMPLETED => 'profile.flash.updated',
NucleosProfileEvents::REGISTRATION_COMPLETED => 'registration.flash.user_created',
];

/**
* @var FlashBagInterface
*/
private $flashBag;
private FlashBagInterface $flashBag;

/**
* @var TranslatorInterface
*/
private $translator;
private TranslatorInterface $translator;

public function __construct(FlashBagInterface $flashBag, TranslatorInterface $translator)
{
Expand Down
10 changes: 2 additions & 8 deletions src/Form/Model/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@

class Profile
{
/**
* @var string|null
*/
protected $locale;
protected ?string $locale = null;

/**
* @var string|null
*/
protected $timezone;
protected ?string $timezone = null;

public static function fromUser(UserInterface $user): self
{
Expand Down
15 changes: 3 additions & 12 deletions src/Form/Model/Registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,11 @@

class Registration
{
/**
* @var string|null
*/
protected $username;
protected ?string $username = null;

/**
* @var string|null
*/
protected $email;
protected ?string $email = null;

/**
* @var string|null
*/
protected $plainPassword;
protected ?string $plainPassword = null;

public function getUsername(): ?string
{
Expand Down
Loading

0 comments on commit 83fbb0d

Please sign in to comment.