Skip to content

Commit e46ca4b

Browse files
committed
chore: User implements UserInterface::getUserIdentifier
also ensure that User.name is declared and is a string.
1 parent 557f09a commit e46ca4b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/Model/User.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ final class User implements
3131
*/
3232
private $accountNonLocked;
3333

34+
private $name;
3435
private $password;
3536
private $roles;
3637

@@ -41,7 +42,7 @@ final class User implements
4142
private $accountUsers = array();
4243
private $policies = array();
4344

44-
public function __construct($name)
45+
public function __construct(string $name)
4546
{
4647
if (empty($name)) {
4748
throw new \InvalidArgumentException('The name cannot be empty.');
@@ -57,6 +58,11 @@ public function __construct($name)
5758
$this->salt = 'KJH6212kjwek_fj23D01-239.1023fkjdsj^k2hdfssfjk!h234uiy4324';
5859
}
5960

61+
public function getUserIdentifier(): string
62+
{
63+
return $this->name;
64+
}
65+
6066
public function getCreatedAt()
6167
{
6268
return $this->createdAt;
@@ -130,7 +136,7 @@ public function getUsername()
130136
return $this->getName();
131137
}
132138

133-
public function setUsername($username)
139+
public function setUsername(string $username)
134140
{
135141
$this->name = $username;
136142
return $this;

0 commit comments

Comments
 (0)