From 8794806e2c6284b0b9ea8f2cbd039b8cbc6cd079 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 19:16:46 +0100 Subject: [PATCH] added type annotations --- src/Entity/User.php | 47 +++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/src/Entity/User.php b/src/Entity/User.php index e8b05fc..8540453 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -3,11 +3,11 @@ namespace App\Entity; use App\Repository\UserRepository; +use DateTime; use DateTimeImmutable; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Stringable; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; @@ -15,7 +15,6 @@ use Symfony\Component\Validator\Constraints as Assert; #[ORM\Entity(repositoryClass: UserRepository::class), ORM\HasLifecycleCallbacks] #[UniqueEntity(fields: ['username', 'email'], message: 'There is already an account with this username or email.')] - class User implements UserInterface, PasswordAuthenticatedUserInterface { #[ORM\Id] @@ -45,22 +44,22 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface private ?string $lastName = ''; #[ORM\ManyToMany(targetEntity: Projects::class, mappedBy: 'developer')] - private $projects; + private Collection $projects; #[ORM\Column(type: 'string', length: 255, nullable: true)] - private string $avatar; + private ?string $avatar; #[ORM\OneToMany(mappedBy: 'owner', targetEntity: Pages::class)] - private $pages; + private Collection $pages; #[ORM\Column(type: 'datetime_immutable')] - private $createdAt; + private DateTimeImmutable $createdAt; #[ORM\Column(type: 'datetime_immutable', nullable: true)] - private $modifiedAt; + private DateTimeImmutable $modifiedAt; #[ORM\Column(type: 'boolean')] - private $isVerified = false; + private bool $isVerified = false; #[ORM\Column] private ?DateTimeImmutable $agreedTermsAt = null; @@ -137,13 +136,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } - /** - * @see UserInterface - */ - public function eraseCredentials() - { - $this->plainPassword = ''; - } public function getEmail(): ?string { @@ -157,10 +149,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } - public function setPlainPassword(string $plainPassword): void - { - $this->plainPassword = $plainPassword; - } public function getFirstName(): ?string { @@ -278,14 +266,14 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } - - /** - * @return string - */ - public function getAvatarUri() - { - return 'avatar'; - } + + /** + * @return string + */ + public function getAvatarUri(): string + { + return 'avatar'; + } #[ORM\PrePersist] public function onPrePersist(): void @@ -322,4 +310,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } + + public function eraseCredentials() + { + // TODO: Implement eraseCredentials() method. + } }