1818 *
1919 * @property-read bool $loggedIn
2020 * @property-read IIdentity $identity
21- * @property-read mixed $id
21+ * @property-read string|int $id
2222 * @property-read array $roles
2323 * @property-read int $logoutReason
2424 * @property IAuthenticator $authenticator
@@ -78,10 +78,7 @@ public function __construct(
7878 }
7979
8080
81- /**
82- * @return UserStorage|IUserStorage
83- */
84- final public function getStorage ()
81+ final public function getStorage (): UserStorage |IUserStorage
8582 {
8683 return $ this ->storage ;
8784 }
@@ -96,7 +93,7 @@ final public function getStorage()
9693 * @throws AuthenticationException if authentication was not successful
9794 */
9895 public function login (
99- $ user ,
96+ string | IIdentity $ user ,
10097 #[\SensitiveParameter]
10198 ?string $ password = null ,
10299 ): void
@@ -202,9 +199,8 @@ private function getStoredData(): void
202199
203200 /**
204201 * Returns current user ID, if any.
205- * @return mixed
206202 */
207- public function getId ()
203+ public function getId (): string | int | null
208204 {
209205 $ identity = $ this ->getIdentity ();
210206 return $ identity ? $ identity ->getId () : null ;
@@ -219,9 +215,8 @@ final public function refreshStorage(): void
219215
220216 /**
221217 * Sets authentication handler.
222- * @return static
223218 */
224- public function setAuthenticator (IAuthenticator $ handler )
219+ public function setAuthenticator (IAuthenticator $ handler ): static
225220 {
226221 $ this ->authenticator = $ handler ;
227222 return $ this ;
@@ -264,15 +259,9 @@ final public function hasAuthenticator(): bool
264259
265260 /**
266261 * Enables log out after inactivity (like '20 minutes').
267- * @param string|null $expire
268- * @param int|bool $clearIdentity
269- * @return static
270262 */
271- public function setExpiration ($ expire , $ clearIdentity = null )
263+ public function setExpiration (? string $ expire , bool | int | null $ clearIdentity = null )
272264 {
273- if ($ expire !== null && !is_string ($ expire )) {
274- trigger_error ("Expiration should be a string like '20 minutes' etc. " , E_USER_DEPRECATED );
275- }
276265
277266 if (func_num_args () > 2 ) {
278267 $ clearIdentity = $ clearIdentity || func_get_arg (2 );
@@ -346,9 +335,8 @@ public function isAllowed($resource = Authorizator::All, $privilege = Authorizat
346335
347336 /**
348337 * Sets authorization handler.
349- * @return static
350338 */
351- public function setAuthorizator (Authorizator $ handler )
339+ public function setAuthorizator (Authorizator $ handler ): static
352340 {
353341 $ this ->authorizator = $ handler ;
354342 return $ this ;
0 commit comments