2222 * @property-read string|int $id
2323 * @property-read array $roles
2424 * @property-read int $logoutReason
25- * @property IAuthenticator $authenticator
25+ * @property Authenticator $authenticator
2626 * @property Authorizator $authorizator
2727 */
2828class User
@@ -65,7 +65,7 @@ class User
6565
6666 public function __construct (
6767 private UserStorage $ storage ,
68- private ?IAuthenticator $ authenticator = null ,
68+ private ?Authenticator $ authenticator = null ,
6969 private ?Authorizator $ authorizator = null ,
7070 ) {
7171 }
@@ -96,9 +96,7 @@ public function login(
9696 $ this ->identity = $ username ;
9797 } else {
9898 $ authenticator = $ this ->getAuthenticator ();
99- $ this ->identity = $ authenticator instanceof Authenticator
100- ? $ authenticator ->authenticate (...func_get_args ())
101- : $ authenticator ->authenticate (func_get_args ());
99+ $ this ->identity = $ authenticator ->authenticate (...func_get_args ());
102100 }
103101
104102 $ id = $ this ->authenticator instanceof IdentityHandler
@@ -189,7 +187,7 @@ final public function refreshStorage(): void
189187 /**
190188 * Sets authentication handler.
191189 */
192- public function setAuthenticator (IAuthenticator $ handler ): static
190+ public function setAuthenticator (Authenticator $ handler ): static
193191 {
194192 $ this ->authenticator = $ handler ;
195193 return $ this ;
@@ -199,7 +197,7 @@ public function setAuthenticator(IAuthenticator $handler): static
199197 /**
200198 * Returns authentication handler.
201199 */
202- final public function getAuthenticator (): IAuthenticator
200+ final public function getAuthenticator (): Authenticator
203201 {
204202 if (!$ this ->authenticator ) {
205203 throw new Nette \InvalidStateException ('Authenticator has not been set. ' );
@@ -212,7 +210,7 @@ final public function getAuthenticator(): IAuthenticator
212210 /**
213211 * Returns authentication handler.
214212 */
215- final public function getAuthenticatorIfExists (): ?IAuthenticator
213+ final public function getAuthenticatorIfExists (): ?Authenticator
216214 {
217215 return $ this ->authenticator ;
218216 }
0 commit comments