From 90b9c0d611ea9971ff324726816bd08bc2a783c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Fri, 8 Mar 2024 01:27:27 +0100 Subject: [PATCH] Add default values to class member variables Strict types Cleanup --- Entity/GoogleToken.php | 46 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 37 deletions(-) diff --git a/Entity/GoogleToken.php b/Entity/GoogleToken.php index 3da7279..e44b176 100644 --- a/Entity/GoogleToken.php +++ b/Entity/GoogleToken.php @@ -20,68 +20,40 @@ use Doctrine\ORM\Event\PreUpdateEventArgs; */ class GoogleToken { /** - * @var int + * Primary key */ - private ?int $id; + private ?int $id = null; /** - * @var string - */ - private string $mail; - - /** - * @var string - */ - private string $access; - - /** - * @var ?string - */ - private ?string $refresh; - - /** - * @var \DateTime - */ - private \DateTime $expired; - - /** - * @var \DateTime + * Create datetime */ private \DateTime $created; /** - * @var \DateTime + * Update datetime */ private \DateTime $updated; /** - * @var \Doctrine\Common\Collections\Collection + * Google calendars collection */ private Collection $googleCalendars; - /** - * @var \Rapsys\AirBundle\Entity\User - */ - private User $user; - /** * Constructor * - * @param \Rapsys\AirBundle\Entity\User $user The user + * @param User $user The user instance * @param string The token user mail * @param string The access token identifier * @param \DateTime The access token expires * @param ?string The refresh token identifier */ - public function __construct(User $user, string $mail, string $access, \DateTime $expired, ?string $refresh = null) { + public function __construct(private User $user, private string $mail, private string $access, private \DateTime $expired, private ?string $refresh = null) { //Set defaults - $this->user = $user; - $this->mail = $mail; - $this->access = $access; - $this->refresh = $refresh; - $this->expired = $expired; $this->created = new \DateTime('now'); $this->updated = new \DateTime('now'); + + //Set collections $this->googleCalendars = new ArrayCollection(); } -- 2.41.0