Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.x] use promoted properties for Auth events #53847

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 8 additions & 29 deletions src/Illuminate/Auth/Events/Attempting.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,18 @@

class Attempting
{
/**
* The authentication guard name.
*
* @var string
*/
public $guard;

/**
* The credentials for the user.
*
* @var array
*/
public $credentials;

/**
* Indicates if the user should be "remembered".
*
* @var bool
*/
public $remember;

/**
* Create a new event instance.
*
* @param string $guard
* @param array $credentials
* @param bool $remember
* @param string $guard The authentication guard name.
* @param array $credentials The credentials for the user.
* @param bool $remember Indicates if the user should be "remembered".
* @return void
*/
public function __construct($guard, #[\SensitiveParameter] $credentials, $remember)
{
$this->guard = $guard;
$this->remember = $remember;
$this->credentials = $credentials;
public function __construct(
public $guard,
#[\SensitiveParameter] public $credentials,
public $remember,
) {
}
}
26 changes: 6 additions & 20 deletions src/Illuminate/Auth/Events/Authenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,16 @@ class Authenticated
{
use SerializesModels;

/**
* The authentication guard name.
*
* @var string
*/
public $guard;

/**
* The authenticated user.
*
* @var \Illuminate\Contracts\Auth\Authenticatable
*/
public $user;

/**
* Create a new event instance.
*
* @param string $guard
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param string $guard The authentication guard name.
* @param \Illuminate\Contracts\Auth\Authenticatable $user The authenticated user.
* @return void
*/
public function __construct($guard, $user)
{
$this->user = $user;
$this->guard = $guard;
public function __construct(
public $guard,
public $user,
) {
}
}
26 changes: 6 additions & 20 deletions src/Illuminate/Auth/Events/CurrentDeviceLogout.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,16 @@ class CurrentDeviceLogout
{
use SerializesModels;

/**
* The authentication guard name.
*
* @var string
*/
public $guard;

/**
* The authenticated user.
*
* @var \Illuminate\Contracts\Auth\Authenticatable
*/
public $user;

/**
* Create a new event instance.
*
* @param string $guard
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param string $guard The authentication guard name.
* @param \Illuminate\Contracts\Auth\Authenticatable $user The authenticated user.
* @return void
*/
public function __construct($guard, $user)
{
$this->user = $user;
$this->guard = $guard;
public function __construct(
public $guard,
public $user,
) {
}
}
37 changes: 8 additions & 29 deletions src/Illuminate/Auth/Events/Failed.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,18 @@

class Failed
{
/**
* The authentication guard name.
*
* @var string
*/
public $guard;

/**
* The user the attempter was trying to authenticate as.
*
* @var \Illuminate\Contracts\Auth\Authenticatable|null
*/
public $user;

/**
* The credentials provided by the attempter.
*
* @var array
*/
public $credentials;

/**
* Create a new event instance.
*
* @param string $guard
* @param \Illuminate\Contracts\Auth\Authenticatable|null $user
* @param array $credentials
* @param string $guard The authentication guard name.
* @param \Illuminate\Contracts\Auth\Authenticatable|null $user The user the attempter was trying to authenticate as.
* @param array $credentials The credentials provided by the attempter.
* @return void
*/
public function __construct($guard, $user, #[\SensitiveParameter] $credentials)
{
$this->user = $user;
$this->guard = $guard;
$this->credentials = $credentials;
public function __construct(
public $guard,
public $user,
#[\SensitiveParameter] public $credentials,
) {
}
}
37 changes: 8 additions & 29 deletions src/Illuminate/Auth/Events/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,18 @@ class Login
{
use SerializesModels;

/**
* The authentication guard name.
*
* @var string
*/
public $guard;

/**
* The authenticated user.
*
* @var \Illuminate\Contracts\Auth\Authenticatable
*/
public $user;

/**
* Indicates if the user should be "remembered".
*
* @var bool
*/
public $remember;

/**
* Create a new event instance.
*
* @param string $guard
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param bool $remember
* @param string $guard The authentication guard name.
* @param \Illuminate\Contracts\Auth\Authenticatable $user The authenticated user.
* @param bool $remember Indicates if the user should be "remembered".
* @return void
*/
public function __construct($guard, $user, $remember)
{
$this->user = $user;
$this->guard = $guard;
$this->remember = $remember;
public function __construct(
public $guard,
public $user,
public $remember,
) {
}
}
26 changes: 6 additions & 20 deletions src/Illuminate/Auth/Events/Logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,16 @@ class Logout
{
use SerializesModels;

/**
* The authentication guard name.
*
* @var string
*/
public $guard;

/**
* The authenticated user.
*
* @var \Illuminate\Contracts\Auth\Authenticatable
*/
public $user;

/**
* Create a new event instance.
*
* @param string $guard
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param string $guard The authentication guard name.
* @param \Illuminate\Contracts\Auth\Authenticatable $user The authenticated user.
* @return void
*/
public function __construct($guard, $user)
{
$this->user = $user;
$this->guard = $guard;
public function __construct(
public $guard,
public $user,
) {
}
}
26 changes: 6 additions & 20 deletions src/Illuminate/Auth/Events/OtherDeviceLogout.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,16 @@ class OtherDeviceLogout
{
use SerializesModels;

/**
* The authentication guard name.
*
* @var string
*/
public $guard;

/**
* The authenticated user.
*
* @var \Illuminate\Contracts\Auth\Authenticatable
*/
public $user;

/**
* Create a new event instance.
*
* @param string $guard
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param string $guard The authentication guard name.
* @param \Illuminate\Contracts\Auth\Authenticatable $user \Illuminate\Contracts\Auth\Authenticatable
* @return void
*/
public function __construct($guard, $user)
{
$this->user = $user;
$this->guard = $guard;
public function __construct(
public $guard,
public $user,
) {
}
}
15 changes: 4 additions & 11 deletions src/Illuminate/Auth/Events/PasswordReset.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,14 @@ class PasswordReset
{
use SerializesModels;

/**
* The user.
*
* @var \Illuminate\Contracts\Auth\Authenticatable
*/
public $user;

/**
* Create a new event instance.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param \Illuminate\Contracts\Auth\Authenticatable $user The user.
* @return void
*/
public function __construct($user)
{
$this->user = $user;
public function __construct(
public $user,
) {
}
}
15 changes: 4 additions & 11 deletions src/Illuminate/Auth/Events/PasswordResetLinkSent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,14 @@ class PasswordResetLinkSent
{
use SerializesModels;

/**
* The user instance.
*
* @var \Illuminate\Contracts\Auth\CanResetPassword
*/
public $user;

/**
* Create a new event instance.
*
* @param \Illuminate\Contracts\Auth\CanResetPassword $user
* @param \Illuminate\Contracts\Auth\CanResetPassword $user The user instance.
* @return void
*/
public function __construct($user)
{
$this->user = $user;
public function __construct(
public $user,
) {
}
}
15 changes: 4 additions & 11 deletions src/Illuminate/Auth/Events/Registered.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,14 @@ class Registered
{
use SerializesModels;

/**
* The authenticated user.
*
* @var \Illuminate\Contracts\Auth\Authenticatable
*/
public $user;

/**
* Create a new event instance.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param \Illuminate\Contracts\Auth\Authenticatable $user The authenticated user.
* @return void
*/
public function __construct($user)
{
$this->user = $user;
public function __construct(
public $user,
) {
}
}
Loading
Loading