File tree Expand file tree Collapse file tree 7 files changed +17
-21
lines changed
Expand file tree Collapse file tree 7 files changed +17
-21
lines changed Original file line number Diff line number Diff line change 1313/**
1414 * AuthenticatorInterface:
1515 *
16- * @method Result attempt(array $credentials)
17- * @method Result check(array $credentials)
18- * @method Authenticatable |null getUser()
19- * @method bool loggedIn()
20- * @method bool login(Authenticatable $user)
21- * @method void loginById($userId)
22- * @method bool logout()
23- * @method void recordActive()
16+ * @method Result attempt(array $credentials)
17+ * @method Result check(array $credentials)
18+ * @method User |null getUser()
19+ * @method bool loggedIn()
20+ * @method bool login(User $user)
21+ * @method void loginById($userId)
22+ * @method bool logout()
23+ * @method void recordActive()
2424 *
2525 * Authenticators\Session:
2626 * @method $this remember(bool $shouldRemember = true)
Original file line number Diff line number Diff line change 77use CodeIgniter \Shield \Authentication \AuthenticationException ;
88use CodeIgniter \Shield \Authentication \AuthenticatorInterface ;
99use CodeIgniter \Shield \Entities \User ;
10- use CodeIgniter \Shield \Interfaces \Authenticatable ;
1110use CodeIgniter \Shield \Interfaces \UserProvider ;
1211use CodeIgniter \Shield \Models \LoginModel ;
1312use CodeIgniter \Shield \Models \UserIdentityModel ;
@@ -227,7 +226,7 @@ public function getBearerToken(): ?string
227226 */
228227 public function recordActive (): void
229228 {
230- if (! $ this ->user instanceof Authenticatable ) {
229+ if (! $ this ->user instanceof User ) {
231230 throw new InvalidArgumentException (self ::class . '::recordActive() requires logged in user before calling. ' );
232231 }
233232
Original file line number Diff line number Diff line change @@ -290,7 +290,7 @@ public function getUser(): ?User
290290 */
291291 public function recordActive (): void
292292 {
293- if (! $ this ->user instanceof Authenticatable ) {
293+ if (! $ this ->user instanceof User ) {
294294 throw new InvalidArgumentException (self ::class . '::recordActive() requires logged in user before calling. ' );
295295 }
296296
Original file line number Diff line number Diff line change 33namespace CodeIgniter \Shield \Authentication \Traits ;
44
55use CodeIgniter \Shield \Entities \User ;
6- use CodeIgniter \Shield \Interfaces \Authenticatable ;
76
87/**
98 * Intended to be used with UserProvider (UserModel).
@@ -70,7 +69,7 @@ public function findByCredentials(array $credentials): ?User
7069 *
7170 * @param int|string $id
7271 */
73- public function findByRememberToken ($ id , string $ token ): ?Authenticatable
72+ public function findByRememberToken ($ id , string $ token ): ?User
7473 {
7574 return $ this ->where ([
7675 'id ' => $ id ,
Original file line number Diff line number Diff line change @@ -25,12 +25,12 @@ public function findByCredentials(array $credentials): ?User;
2525 *
2626 * @param int|string $id
2727 */
28- public function findByRememberToken ($ id , string $ token ): ?Authenticatable ;
28+ public function findByRememberToken ($ id , string $ token ): ?User ;
2929
3030 /**
3131 * Given a User object, will update the record
3232 * in the database. This is often a User entity
3333 * that already has the correct values set.
3434 */
35- public function save (Authenticatable $ data ): bool ;
35+ public function save (User $ data ): bool ;
3636}
Original file line number Diff line number Diff line change 33namespace CodeIgniter \Shield ;
44
55use CodeIgniter \Shield \Entities \User ;
6- use CodeIgniter \Shield \Interfaces \Authenticatable ;
76
87class Result
98{
@@ -19,13 +18,13 @@ class Result
1918 /**
2019 * Extra information.
2120 *
22- * @var Authenticatable| string|null `Authenticatable ` when successful. Suggestion strings when fails.
21+ * @var string|User| null `User ` when successful. Suggestion strings when fails.
2322 */
2423 protected $ extraInfo ;
2524
2625 /**
27- * @phpstan-param array{success: bool, reason?: string|null, extraInfo?: string|Authenticatable } $details
28- * @psalm-param array{success: bool, reason?: string|null, extraInfo?: string|Authenticatable } $details
26+ * @phpstan-param array{success: bool, reason?: string|null, extraInfo?: string|User } $details
27+ * @psalm-param array{success: bool, reason?: string|null, extraInfo?: string|User } $details
2928 */
3029 public function __construct (array $ details )
3130 {
Original file line number Diff line number Diff line change 33namespace CodeIgniter \Shield \Test ;
44
55use CodeIgniter \Shield \Entities \User ;
6- use CodeIgniter \Shield \Interfaces \Authenticatable ;
76
87/**
98 * Trait AuthenticationTesting
@@ -17,7 +16,7 @@ trait AuthenticationTesting
1716 *
1817 * @return $this
1918 */
20- public function actingAs (Authenticatable $ user ): self
19+ public function actingAs (User $ user ): self
2120 {
2221 // Ensure the helper is loaded during tests.
2322 helper ('auth ' );
You can’t perform that action at this time.
0 commit comments