From d2973fd58b13acae3debf4de162e7c2d7233ba73 Mon Sep 17 00:00:00 2001 From: Caleb White Date: Thu, 2 Jan 2025 15:39:25 -0600 Subject: [PATCH] fix: intersect Authenticatable with Model in UserProvider --- src/Illuminate/Auth/EloquentUserProvider.php | 20 +++++++++---------- .../Contracts/Auth/UserProvider.php | 12 +++++------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Illuminate/Auth/EloquentUserProvider.php b/src/Illuminate/Auth/EloquentUserProvider.php index 77c8fef712b1..bf420342907b 100755 --- a/src/Illuminate/Auth/EloquentUserProvider.php +++ b/src/Illuminate/Auth/EloquentUserProvider.php @@ -20,7 +20,7 @@ class EloquentUserProvider implements UserProvider /** * The Eloquent user model. * - * @var string + * @var class-string<\Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model> */ protected $model; @@ -48,7 +48,7 @@ public function __construct(HasherContract $hasher, $model) * Retrieve a user by their unique identifier. * * @param mixed $identifier - * @return \Illuminate\Contracts\Auth\Authenticatable|null + * @return (\Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model)|null */ public function retrieveById($identifier) { @@ -64,7 +64,7 @@ public function retrieveById($identifier) * * @param mixed $identifier * @param string $token - * @return \Illuminate\Contracts\Auth\Authenticatable|null + * @return (\Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model)|null */ public function retrieveByToken($identifier, #[\SensitiveParameter] $token) { @@ -86,7 +86,7 @@ public function retrieveByToken($identifier, #[\SensitiveParameter] $token) /** * Update the "remember me" token for the given user in storage. * - * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param \Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model $user * @param string $token * @return void */ @@ -107,7 +107,7 @@ public function updateRememberToken(UserContract $user, #[\SensitiveParameter] $ * Retrieve a user by the given credentials. * * @param array $credentials - * @return \Illuminate\Contracts\Auth\Authenticatable|null + * @return (\Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model)|null */ public function retrieveByCredentials(#[\SensitiveParameter] array $credentials) { @@ -142,7 +142,7 @@ public function retrieveByCredentials(#[\SensitiveParameter] array $credentials) /** * Validate a user against the given credentials. * - * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param \Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model $user * @param array $credentials * @return bool */ @@ -162,7 +162,7 @@ public function validateCredentials(UserContract $user, #[\SensitiveParameter] a /** * Rehash the user's password if required and supported. * - * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param \Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model $user * @param array $credentials * @param bool $force * @return void @@ -200,7 +200,7 @@ protected function newModelQuery($model = null) /** * Create a new instance of the model. * - * @return \Illuminate\Database\Eloquent\Model + * @return \Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model */ public function createModel() { @@ -235,7 +235,7 @@ public function setHasher(HasherContract $hasher) /** * Gets the name of the Eloquent user model. * - * @return string + * @return class-string<\Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model> */ public function getModel() { @@ -245,7 +245,7 @@ public function getModel() /** * Sets the name of the Eloquent user model. * - * @param string $model + * @param class-string<\Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model> $model * @return $this */ public function setModel($model) diff --git a/src/Illuminate/Contracts/Auth/UserProvider.php b/src/Illuminate/Contracts/Auth/UserProvider.php index dd9bb419440c..686e519ed62d 100644 --- a/src/Illuminate/Contracts/Auth/UserProvider.php +++ b/src/Illuminate/Contracts/Auth/UserProvider.php @@ -8,7 +8,7 @@ interface UserProvider * Retrieve a user by their unique identifier. * * @param mixed $identifier - * @return \Illuminate\Contracts\Auth\Authenticatable|null + * @return (\Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model)|null */ public function retrieveById($identifier); @@ -17,14 +17,14 @@ public function retrieveById($identifier); * * @param mixed $identifier * @param string $token - * @return \Illuminate\Contracts\Auth\Authenticatable|null + * @return (\Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model)|null */ public function retrieveByToken($identifier, #[\SensitiveParameter] $token); /** * Update the "remember me" token for the given user in storage. * - * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param \Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model $user * @param string $token * @return void */ @@ -34,14 +34,14 @@ public function updateRememberToken(Authenticatable $user, #[\SensitiveParameter * Retrieve a user by the given credentials. * * @param array $credentials - * @return \Illuminate\Contracts\Auth\Authenticatable|null + * @return (\Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model)|null */ public function retrieveByCredentials(#[\SensitiveParameter] array $credentials); /** * Validate a user against the given credentials. * - * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param \Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model $user * @param array $credentials * @return bool */ @@ -50,7 +50,7 @@ public function validateCredentials(Authenticatable $user, #[\SensitiveParameter /** * Rehash the user's password if required and supported. * - * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param \Illuminate\Contracts\Auth\Authenticatable&\Illuminate\Database\Eloquent\Model $user * @param array $credentials * @param bool $force * @return void