added type annotations

This commit is contained in:
tracer 2022-11-03 19:16:46 +01:00
parent 2aeeb0d87e
commit 8794806e2c
1 changed files with 20 additions and 27 deletions

View File

@ -3,11 +3,11 @@
namespace App\Entity; namespace App\Entity;
use App\Repository\UserRepository; use App\Repository\UserRepository;
use DateTime;
use DateTimeImmutable; use DateTimeImmutable;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Stringable;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface; 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] #[ORM\Entity(repositoryClass: UserRepository::class), ORM\HasLifecycleCallbacks]
#[UniqueEntity(fields: ['username', 'email'], message: 'There is already an account with this username or email.')] #[UniqueEntity(fields: ['username', 'email'], message: 'There is already an account with this username or email.')]
class User implements UserInterface, PasswordAuthenticatedUserInterface class User implements UserInterface, PasswordAuthenticatedUserInterface
{ {
#[ORM\Id] #[ORM\Id]
@ -45,22 +44,22 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
private ?string $lastName = ''; private ?string $lastName = '';
#[ORM\ManyToMany(targetEntity: Projects::class, mappedBy: 'developer')] #[ORM\ManyToMany(targetEntity: Projects::class, mappedBy: 'developer')]
private $projects; private Collection $projects;
#[ORM\Column(type: 'string', length: 255, nullable: true)] #[ORM\Column(type: 'string', length: 255, nullable: true)]
private string $avatar; private ?string $avatar;
#[ORM\OneToMany(mappedBy: 'owner', targetEntity: Pages::class)] #[ORM\OneToMany(mappedBy: 'owner', targetEntity: Pages::class)]
private $pages; private Collection $pages;
#[ORM\Column(type: 'datetime_immutable')] #[ORM\Column(type: 'datetime_immutable')]
private $createdAt; private DateTimeImmutable $createdAt;
#[ORM\Column(type: 'datetime_immutable', nullable: true)] #[ORM\Column(type: 'datetime_immutable', nullable: true)]
private $modifiedAt; private DateTimeImmutable $modifiedAt;
#[ORM\Column(type: 'boolean')] #[ORM\Column(type: 'boolean')]
private $isVerified = false; private bool $isVerified = false;
#[ORM\Column] #[ORM\Column]
private ?DateTimeImmutable $agreedTermsAt = null; private ?DateTimeImmutable $agreedTermsAt = null;
@ -137,13 +136,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this; return $this;
} }
/**
* @see UserInterface
*/
public function eraseCredentials()
{
$this->plainPassword = '';
}
public function getEmail(): ?string public function getEmail(): ?string
{ {
@ -157,10 +149,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this; return $this;
} }
public function setPlainPassword(string $plainPassword): void
{
$this->plainPassword = $plainPassword;
}
public function getFirstName(): ?string public function getFirstName(): ?string
{ {
@ -278,14 +266,14 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
public function getAvatarUri() public function getAvatarUri(): string
{ {
return 'avatar'; return 'avatar';
} }
#[ORM\PrePersist] #[ORM\PrePersist]
public function onPrePersist(): void public function onPrePersist(): void
@ -322,4 +310,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this; return $this;
} }
public function eraseCredentials()
{
// TODO: Implement eraseCredentials() method.
}
} }