for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Security;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* Class User
* @package App\Security
*/
class User implements UserInterface
{
* @var string
private $email;
* @var string[]
private $roles = [];
* User constructor.
* @param string|null $email
public function __construct(string $email = null)
$this->email = $email;
}
* @return string|null
public function getEmail(): ?string
return $this->email;
* @param string $email
* @return $this
public function setEmail(string $email): self
return $this;
* A visual identifier that represents this user.
*
* @see UserInterface
public function getUsername(): string
return (string) $this->email;
public function getRoles(): array
$roles = $this->roles;
$roles[] = 'ROLE_USER';
return array_unique($roles);
public function setRoles(array $roles): self
$this->roles = $roles;
public function getPassword()
// not needed for apps that do not check user passwords
public function getSalt()
public function eraseCredentials()
// If you store any temporary, sensitive data on the user, clear it here