@@ -40,6 +40,8 @@ public function __construct(Authentication $authenticate)
4040
4141 /**
4242 * Sets the Authenticator alias that should be used for this request.
43+ *
44+ * @return $this
4345 */
4446 public function setAuthenticator (?string $ alias = null )
4547 {
@@ -52,21 +54,17 @@ public function setAuthenticator(?string $alias = null)
5254
5355 /**
5456 * Returns the current authentication class.
55- *
56- * @return AuthenticatorInterface
5757 */
58- public function getAuthenticator ()
58+ public function getAuthenticator (): AuthenticatorInterface
5959 {
6060 return $ this ->authenticate
6161 ->factory ($ this ->alias );
6262 }
6363
6464 /**
6565 * Returns the current user, if logged in.
66- *
67- * @return Authenticatable|null
6866 */
69- public function user ()
67+ public function user (): ? Authenticatable
7068 {
7169 return $ this ->getAuthenticator ()->loggedIn ()
7270 ? $ this ->getAuthenticator ()->getUser ()
@@ -76,7 +74,7 @@ public function user()
7674 /**
7775 * Returns the current user's id, if logged in.
7876 *
79- * @return mixed |null
77+ * @return int|string |null
8078 */
8179 public function id ()
8280 {
@@ -85,7 +83,7 @@ public function id()
8583 : null ;
8684 }
8785
88- public function authenticate (array $ credentials )
86+ public function authenticate (array $ credentials ): Result
8987 {
9088 $ response = $ this ->authenticate
9189 ->factory ($ this ->alias )
@@ -106,11 +104,11 @@ public function authenticate(array $credentials)
106104 * - auth()->routes($routes);
107105 * - auth()->routes($routes, ['except' => ['login', 'register']])
108106 */
109- public function routes (RouteCollection &$ routes , array $ config = [])
107+ public function routes (RouteCollection &$ routes , array $ config = []): void
110108 {
111109 $ authRoutes = config ('AuthRoutes ' )->routes ;
112110
113- $ routes ->group ('/ ' , ['namespace ' => 'CodeIgniter\Shield\Controllers ' ], static function ($ routes ) use ($ authRoutes , $ config ) {
111+ $ routes ->group ('/ ' , ['namespace ' => 'CodeIgniter\Shield\Controllers ' ], static function (RouteCollection $ routes ) use ($ authRoutes , $ config ) {
114112 foreach ($ authRoutes as $ name => $ row ) {
115113 if (! isset ($ config ['except ' ]) || (isset ($ config ['except ' ]) && ! in_array ($ name , $ config ['except ' ], true ))) {
116114 foreach ($ row as $ params ) {
@@ -128,10 +126,8 @@ public function routes(RouteCollection &$routes, array $config = [])
128126 * Returns the Model that is responsible for getting users.
129127 *
130128 * @throws AuthenticationException
131- *
132- * @return mixed|UserProvider
133129 */
134- public function getProvider ()
130+ public function getProvider (): UserProvider
135131 {
136132 if ($ this ->userProvider !== null ) {
137133 return $ this ->userProvider ;
@@ -155,12 +151,11 @@ public function getProvider()
155151 * own, additional, features on top of the required ones,
156152 * like "remember-me" functionality.
157153 *
158- * @param string $method
159- * @param array $args
154+ * @param string[] $args
160155 *
161156 * @throws AuthenticationException
162157 */
163- public function __call ($ method , $ args )
158+ public function __call (string $ method , array $ args )
164159 {
165160 $ authenticate = $ this ->authenticate ->factory ($ this ->alias );
166161
0 commit comments