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;
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.
}
}