From 69b19ceebec7e2cb16ee54c6dfbf082f3d81cee1 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 10 Dec 2024 09:13:12 -0600 Subject: [PATCH] [11.x] use promoted properties (#53807) * use promoted properties this commit uses promoted properties to remove a lot of boilerplate code. I avoided promoting any `public` properties that lacked type-hints, but had type-hints in the constructor signature. while unlikely to cause issues, this technically is a change in behavior, and should be handled against the `master` branch. I **did** upgrade `protected` properties that lacked type hints to the type hint provided in the constructor signature. This should be okay because even though the properties themselves weren't type-hinted, the only way to update them was through a type-hinted constructor. some styling decisions made in this PR: - ALWAYS use multiline constructors, with each parameter on a new line - use a trailing comma in multiline constructors - leave in constructor docblocks for now. could/should be removed eventually * style fix * fix styling --- .../Auth/Access/Events/GateEvaluated.php | 40 +++---------------- src/Illuminate/Auth/DatabaseUserProvider.php | 31 +++----------- src/Illuminate/Auth/EloquentUserProvider.php | 22 ++-------- src/Illuminate/Auth/Events/Attempting.php | 31 +++----------- src/Illuminate/Auth/Events/Authenticated.php | 22 ++-------- .../Auth/Events/CurrentDeviceLogout.php | 22 ++-------- src/Illuminate/Auth/Events/Failed.php | 31 +++----------- src/Illuminate/Auth/Events/Login.php | 31 +++----------- src/Illuminate/Auth/Events/Logout.php | 22 ++-------- .../Auth/Events/OtherDeviceLogout.php | 22 ++-------- src/Illuminate/Auth/Events/PasswordReset.php | 13 ++---- .../Auth/Events/PasswordResetLinkSent.php | 13 ++---- src/Illuminate/Auth/Events/Registered.php | 13 ++---- src/Illuminate/Auth/Events/Validated.php | 22 ++-------- src/Illuminate/Auth/Events/Verified.php | 13 ++---- src/Illuminate/Auth/GenericUser.php | 13 ++---- .../Auth/Middleware/Authenticate.php | 13 ++---- .../Middleware/AuthenticateWithBasicAuth.php | 13 ++---- src/Illuminate/Auth/Middleware/Authorize.php | 13 ++---- .../Auth/Notifications/ResetPassword.php | 13 ++---- .../Auth/Passwords/PasswordBrokerManager.php | 13 ++---- src/Illuminate/Bus/BatchFactory.php | 13 ++---- .../Bus/DatabaseBatchRepository.php | 31 +++----------- src/Illuminate/Bus/UniqueLock.php | 13 ++---- src/Illuminate/Cache/ApcStore.php | 22 ++-------- src/Illuminate/Cache/ArrayStore.php | 13 ++---- src/Illuminate/Cache/CacheManager.php | 13 ++---- src/Illuminate/Cache/Console/ClearCommand.php | 23 ++--------- .../Cache/Console/ForgetCommand.php | 14 ++----- src/Illuminate/Cache/RateLimiter.php | 13 ++---- src/Illuminate/Cache/Repository.php | 22 ++-------- src/Illuminate/Cache/TagSet.php | 22 ++-------- src/Illuminate/Http/Client/Request.php | 13 ++---- src/Illuminate/Http/Client/Response.php | 13 ++---- .../Http/Client/ResponseSequence.php | 13 ++---- src/Illuminate/Http/Middleware/HandleCors.php | 22 ++-------- src/Illuminate/Http/Middleware/TrustHosts.php | 13 ++---- .../Http/Resources/Json/JsonResource.php | 13 ++---- .../Http/Resources/Json/ResourceResponse.php | 13 ++---- .../Log/Context/Events/ContextDehydrating.php | 13 ++---- .../Log/Context/Events/ContextHydrated.php | 13 ++---- src/Illuminate/Log/LogManager.php | 13 ++---- src/Illuminate/Log/Logger.php | 22 ++-------- src/Illuminate/Mail/PendingMail.php | 13 ++---- src/Illuminate/Mail/SentMessage.php | 13 ++---- src/Illuminate/Mail/TextMessage.php | 13 ++---- .../Mail/Transport/LogTransport.php | 13 ++---- src/Illuminate/View/Engines/FileEngine.php | 13 ++---- src/Illuminate/View/Engines/PhpEngine.php | 13 ++---- .../Middleware/ShareErrorsFromSession.php | 13 ++---- 50 files changed, 175 insertions(+), 702 deletions(-) diff --git a/src/Illuminate/Auth/Access/Events/GateEvaluated.php b/src/Illuminate/Auth/Access/Events/GateEvaluated.php index f77a9c84c51b..2e08fab4a87a 100644 --- a/src/Illuminate/Auth/Access/Events/GateEvaluated.php +++ b/src/Illuminate/Auth/Access/Events/GateEvaluated.php @@ -4,34 +4,6 @@ class GateEvaluated { - /** - * The authenticatable model. - * - * @var \Illuminate\Contracts\Auth\Authenticatable|null - */ - public $user; - - /** - * The ability being evaluated. - * - * @var string - */ - public $ability; - - /** - * The result of the evaluation. - * - * @var bool|null - */ - public $result; - - /** - * The arguments given during evaluation. - * - * @var array - */ - public $arguments; - /** * Create a new event instance. * @@ -41,11 +13,11 @@ class GateEvaluated * @param array $arguments * @return void */ - public function __construct($user, $ability, $result, $arguments) - { - $this->user = $user; - $this->ability = $ability; - $this->result = $result; - $this->arguments = $arguments; + public function __construct( + public $user, + public $ability, + public $result, + public $arguments, + ) { } } diff --git a/src/Illuminate/Auth/DatabaseUserProvider.php b/src/Illuminate/Auth/DatabaseUserProvider.php index aaaafd8a8b45..373f787004be 100755 --- a/src/Illuminate/Auth/DatabaseUserProvider.php +++ b/src/Illuminate/Auth/DatabaseUserProvider.php @@ -11,27 +11,6 @@ class DatabaseUserProvider implements UserProvider { - /** - * The active database connection. - * - * @var \Illuminate\Database\ConnectionInterface - */ - protected $connection; - - /** - * The hasher implementation. - * - * @var \Illuminate\Contracts\Hashing\Hasher - */ - protected $hasher; - - /** - * The table containing the users. - * - * @var string - */ - protected $table; - /** * Create a new database user provider. * @@ -40,11 +19,11 @@ class DatabaseUserProvider implements UserProvider * @param string $table * @return void */ - public function __construct(ConnectionInterface $connection, HasherContract $hasher, $table) - { - $this->connection = $connection; - $this->table = $table; - $this->hasher = $hasher; + public function __construct( + protected ConnectionInterface $connection, + protected HasherContract $hasher, + protected $table, + ) { } /** diff --git a/src/Illuminate/Auth/EloquentUserProvider.php b/src/Illuminate/Auth/EloquentUserProvider.php index 77c8fef712b1..488bbceb6775 100755 --- a/src/Illuminate/Auth/EloquentUserProvider.php +++ b/src/Illuminate/Auth/EloquentUserProvider.php @@ -10,20 +10,6 @@ class EloquentUserProvider implements UserProvider { - /** - * The hasher implementation. - * - * @var \Illuminate\Contracts\Hashing\Hasher - */ - protected $hasher; - - /** - * The Eloquent user model. - * - * @var string - */ - protected $model; - /** * The callback that may modify the user retrieval queries. * @@ -38,10 +24,10 @@ class EloquentUserProvider implements UserProvider * @param string $model * @return void */ - public function __construct(HasherContract $hasher, $model) - { - $this->model = $model; - $this->hasher = $hasher; + public function __construct( + protected HasherContract $hasher, + protected $model, + ) { } /** diff --git a/src/Illuminate/Auth/Events/Attempting.php b/src/Illuminate/Auth/Events/Attempting.php index e4500e33b735..500c67c92638 100644 --- a/src/Illuminate/Auth/Events/Attempting.php +++ b/src/Illuminate/Auth/Events/Attempting.php @@ -4,27 +4,6 @@ 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. * @@ -33,10 +12,10 @@ class Attempting * @param bool $remember * @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, + ) { } } diff --git a/src/Illuminate/Auth/Events/Authenticated.php b/src/Illuminate/Auth/Events/Authenticated.php index faefcbecba3a..89d8d7df24d6 100644 --- a/src/Illuminate/Auth/Events/Authenticated.php +++ b/src/Illuminate/Auth/Events/Authenticated.php @@ -8,20 +8,6 @@ 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. * @@ -29,9 +15,9 @@ class Authenticated * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return void */ - public function __construct($guard, $user) - { - $this->user = $user; - $this->guard = $guard; + public function __construct( + public $guard, + public $user, + ) { } } diff --git a/src/Illuminate/Auth/Events/CurrentDeviceLogout.php b/src/Illuminate/Auth/Events/CurrentDeviceLogout.php index 32d31faf6448..1d97595ec284 100644 --- a/src/Illuminate/Auth/Events/CurrentDeviceLogout.php +++ b/src/Illuminate/Auth/Events/CurrentDeviceLogout.php @@ -8,20 +8,6 @@ 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. * @@ -29,9 +15,9 @@ class CurrentDeviceLogout * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return void */ - public function __construct($guard, $user) - { - $this->user = $user; - $this->guard = $guard; + public function __construct( + public $guard, + public $user, + ) { } } diff --git a/src/Illuminate/Auth/Events/Failed.php b/src/Illuminate/Auth/Events/Failed.php index b29940e3ae5f..6041ca774158 100644 --- a/src/Illuminate/Auth/Events/Failed.php +++ b/src/Illuminate/Auth/Events/Failed.php @@ -4,27 +4,6 @@ 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. * @@ -33,10 +12,10 @@ class Failed * @param array $credentials * @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, + ) { } } diff --git a/src/Illuminate/Auth/Events/Login.php b/src/Illuminate/Auth/Events/Login.php index 87a399eab38b..3885d5b88e35 100644 --- a/src/Illuminate/Auth/Events/Login.php +++ b/src/Illuminate/Auth/Events/Login.php @@ -8,27 +8,6 @@ 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. * @@ -37,10 +16,10 @@ class Login * @param bool $remember * @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, + ) { } } diff --git a/src/Illuminate/Auth/Events/Logout.php b/src/Illuminate/Auth/Events/Logout.php index c47341dc5601..e60f3ee2fba1 100644 --- a/src/Illuminate/Auth/Events/Logout.php +++ b/src/Illuminate/Auth/Events/Logout.php @@ -8,20 +8,6 @@ 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. * @@ -29,9 +15,9 @@ class Logout * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return void */ - public function __construct($guard, $user) - { - $this->user = $user; - $this->guard = $guard; + public function __construct( + public $guard, + public $user, + ) { } } diff --git a/src/Illuminate/Auth/Events/OtherDeviceLogout.php b/src/Illuminate/Auth/Events/OtherDeviceLogout.php index ea139a7b496e..59279f059bd7 100644 --- a/src/Illuminate/Auth/Events/OtherDeviceLogout.php +++ b/src/Illuminate/Auth/Events/OtherDeviceLogout.php @@ -8,20 +8,6 @@ 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. * @@ -29,9 +15,9 @@ class OtherDeviceLogout * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return void */ - public function __construct($guard, $user) - { - $this->user = $user; - $this->guard = $guard; + public function __construct( + public $guard, + public $user, + ) { } } diff --git a/src/Illuminate/Auth/Events/PasswordReset.php b/src/Illuminate/Auth/Events/PasswordReset.php index f57b3c947660..e80f128e3ad4 100644 --- a/src/Illuminate/Auth/Events/PasswordReset.php +++ b/src/Illuminate/Auth/Events/PasswordReset.php @@ -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 * @return void */ - public function __construct($user) - { - $this->user = $user; + public function __construct( + public $user, + ) { } } diff --git a/src/Illuminate/Auth/Events/PasswordResetLinkSent.php b/src/Illuminate/Auth/Events/PasswordResetLinkSent.php index 233e92db34fd..28e694061306 100644 --- a/src/Illuminate/Auth/Events/PasswordResetLinkSent.php +++ b/src/Illuminate/Auth/Events/PasswordResetLinkSent.php @@ -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 * @return void */ - public function __construct($user) - { - $this->user = $user; + public function __construct( + public $user, + ) { } } diff --git a/src/Illuminate/Auth/Events/Registered.php b/src/Illuminate/Auth/Events/Registered.php index f84058cf1fed..836689bd25ae 100644 --- a/src/Illuminate/Auth/Events/Registered.php +++ b/src/Illuminate/Auth/Events/Registered.php @@ -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 * @return void */ - public function __construct($user) - { - $this->user = $user; + public function __construct( + public $user, + ) { } } diff --git a/src/Illuminate/Auth/Events/Validated.php b/src/Illuminate/Auth/Events/Validated.php index ebc3b2ce1797..23b8d43cd68b 100644 --- a/src/Illuminate/Auth/Events/Validated.php +++ b/src/Illuminate/Auth/Events/Validated.php @@ -8,20 +8,6 @@ class Validated { use SerializesModels; - /** - * The authentication guard name. - * - * @var string - */ - public $guard; - - /** - * The user retrieved and validated from the User Provider. - * - * @var \Illuminate\Contracts\Auth\Authenticatable - */ - public $user; - /** * Create a new event instance. * @@ -29,9 +15,9 @@ class Validated * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return void */ - public function __construct($guard, $user) - { - $this->user = $user; - $this->guard = $guard; + public function __construct( + public $guard, + public $user, + ) { } } diff --git a/src/Illuminate/Auth/Events/Verified.php b/src/Illuminate/Auth/Events/Verified.php index 1d6e4c0f3448..80f9f3c08989 100644 --- a/src/Illuminate/Auth/Events/Verified.php +++ b/src/Illuminate/Auth/Events/Verified.php @@ -8,21 +8,14 @@ class Verified { use SerializesModels; - /** - * The verified user. - * - * @var \Illuminate\Contracts\Auth\MustVerifyEmail - */ - public $user; - /** * Create a new event instance. * * @param \Illuminate\Contracts\Auth\MustVerifyEmail $user * @return void */ - public function __construct($user) - { - $this->user = $user; + public function __construct( + public $user, + ) { } } diff --git a/src/Illuminate/Auth/GenericUser.php b/src/Illuminate/Auth/GenericUser.php index d015e5b4b617..e2fbd11b2a32 100755 --- a/src/Illuminate/Auth/GenericUser.php +++ b/src/Illuminate/Auth/GenericUser.php @@ -6,22 +6,15 @@ class GenericUser implements UserContract { - /** - * All of the user's attributes. - * - * @var array - */ - protected $attributes; - /** * Create a new generic User object. * * @param array $attributes * @return void */ - public function __construct(array $attributes) - { - $this->attributes = $attributes; + public function __construct( + protected array $attributes, + ) { } /** diff --git a/src/Illuminate/Auth/Middleware/Authenticate.php b/src/Illuminate/Auth/Middleware/Authenticate.php index 81d4ee455ae3..acb365d68368 100644 --- a/src/Illuminate/Auth/Middleware/Authenticate.php +++ b/src/Illuminate/Auth/Middleware/Authenticate.php @@ -10,13 +10,6 @@ class Authenticate implements AuthenticatesRequests { - /** - * The authentication factory instance. - * - * @var \Illuminate\Contracts\Auth\Factory - */ - protected $auth; - /** * The callback that should be used to generate the authentication redirect path. * @@ -30,9 +23,9 @@ class Authenticate implements AuthenticatesRequests * @param \Illuminate\Contracts\Auth\Factory $auth * @return void */ - public function __construct(Auth $auth) - { - $this->auth = $auth; + public function __construct( + protected Auth $auth, + ) { } /** diff --git a/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php b/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php index 0b4510c0fb66..026e9baf5a4b 100644 --- a/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php +++ b/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php @@ -7,22 +7,15 @@ class AuthenticateWithBasicAuth { - /** - * The guard factory instance. - * - * @var \Illuminate\Contracts\Auth\Factory - */ - protected $auth; - /** * Create a new middleware instance. * * @param \Illuminate\Contracts\Auth\Factory $auth * @return void */ - public function __construct(AuthFactory $auth) - { - $this->auth = $auth; + public function __construct( + protected AuthFactory $auth, + ) { } /** diff --git a/src/Illuminate/Auth/Middleware/Authorize.php b/src/Illuminate/Auth/Middleware/Authorize.php index d5b83660c500..368245a66040 100644 --- a/src/Illuminate/Auth/Middleware/Authorize.php +++ b/src/Illuminate/Auth/Middleware/Authorize.php @@ -11,22 +11,15 @@ class Authorize { - /** - * The gate instance. - * - * @var \Illuminate\Contracts\Auth\Access\Gate - */ - protected $gate; - /** * Create a new middleware instance. * * @param \Illuminate\Contracts\Auth\Access\Gate $gate * @return void */ - public function __construct(Gate $gate) - { - $this->gate = $gate; + public function __construct( + protected Gate $gate, + ) { } /** diff --git a/src/Illuminate/Auth/Notifications/ResetPassword.php b/src/Illuminate/Auth/Notifications/ResetPassword.php index d31ae210c943..1cbb545ee109 100644 --- a/src/Illuminate/Auth/Notifications/ResetPassword.php +++ b/src/Illuminate/Auth/Notifications/ResetPassword.php @@ -8,13 +8,6 @@ class ResetPassword extends Notification { - /** - * The password reset token. - * - * @var string - */ - public $token; - /** * The callback that should be used to create the reset password URL. * @@ -35,9 +28,9 @@ class ResetPassword extends Notification * @param string $token * @return void */ - public function __construct(#[\SensitiveParameter] $token) - { - $this->token = $token; + public function __construct( + #[\SensitiveParameter] public $token, + ) { } /** diff --git a/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php b/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php index c388c693df79..95a2711fb40e 100644 --- a/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php +++ b/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php @@ -10,13 +10,6 @@ */ class PasswordBrokerManager implements FactoryContract { - /** - * The application instance. - * - * @var \Illuminate\Contracts\Foundation\Application - */ - protected $app; - /** * The array of created "drivers". * @@ -30,9 +23,9 @@ class PasswordBrokerManager implements FactoryContract * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ - public function __construct($app) - { - $this->app = $app; + public function __construct( + protected $app, + ) { } /** diff --git a/src/Illuminate/Bus/BatchFactory.php b/src/Illuminate/Bus/BatchFactory.php index 2c3a4e96ce57..c34dd1ea5b3a 100644 --- a/src/Illuminate/Bus/BatchFactory.php +++ b/src/Illuminate/Bus/BatchFactory.php @@ -7,22 +7,15 @@ class BatchFactory { - /** - * The queue factory implementation. - * - * @var \Illuminate\Contracts\Queue\Factory - */ - protected $queue; - /** * Create a new batch factory instance. * * @param \Illuminate\Contracts\Queue\Factory $queue * @return void */ - public function __construct(QueueFactory $queue) - { - $this->queue = $queue; + public function __construct( + protected QueueFactory $queue, + ) { } /** diff --git a/src/Illuminate/Bus/DatabaseBatchRepository.php b/src/Illuminate/Bus/DatabaseBatchRepository.php index d6130ede6c63..f5ecc55b8271 100644 --- a/src/Illuminate/Bus/DatabaseBatchRepository.php +++ b/src/Illuminate/Bus/DatabaseBatchRepository.php @@ -13,27 +13,6 @@ class DatabaseBatchRepository implements PrunableBatchRepository { - /** - * The batch factory instance. - * - * @var \Illuminate\Bus\BatchFactory - */ - protected $factory; - - /** - * The database connection instance. - * - * @var \Illuminate\Database\Connection - */ - protected $connection; - - /** - * The database table to use to store batch information. - * - * @var string - */ - protected $table; - /** * Create a new batch repository instance. * @@ -41,11 +20,11 @@ class DatabaseBatchRepository implements PrunableBatchRepository * @param \Illuminate\Database\Connection $connection * @param string $table */ - public function __construct(BatchFactory $factory, Connection $connection, string $table) - { - $this->factory = $factory; - $this->connection = $connection; - $this->table = $table; + public function __construct( + protected BatchFactory $factory, + protected Connection $connection, + protected string $table, + ) { } /** diff --git a/src/Illuminate/Bus/UniqueLock.php b/src/Illuminate/Bus/UniqueLock.php index dea12303b719..a23ea42799c9 100644 --- a/src/Illuminate/Bus/UniqueLock.php +++ b/src/Illuminate/Bus/UniqueLock.php @@ -6,22 +6,15 @@ class UniqueLock { - /** - * The cache repository implementation. - * - * @var \Illuminate\Contracts\Cache\Repository - */ - protected $cache; - /** * Create a new unique lock manager instance. * * @param \Illuminate\Contracts\Cache\Repository $cache * @return void */ - public function __construct(Cache $cache) - { - $this->cache = $cache; + public function __construct( + protected Cache $cache, + ) { } /** diff --git a/src/Illuminate/Cache/ApcStore.php b/src/Illuminate/Cache/ApcStore.php index 8bba88b50708..452d5ef1ce0c 100755 --- a/src/Illuminate/Cache/ApcStore.php +++ b/src/Illuminate/Cache/ApcStore.php @@ -6,20 +6,6 @@ class ApcStore extends TaggableStore { use RetrievesMultipleKeys; - /** - * The APC wrapper instance. - * - * @var \Illuminate\Cache\ApcWrapper - */ - protected $apc; - - /** - * A string that should be prepended to keys. - * - * @var string - */ - protected $prefix; - /** * Create a new APC store. * @@ -27,10 +13,10 @@ class ApcStore extends TaggableStore * @param string $prefix * @return void */ - public function __construct(ApcWrapper $apc, $prefix = '') - { - $this->apc = $apc; - $this->prefix = $prefix; + public function __construct( + protected ApcWrapper $apc, + protected $prefix = '', + ) { } /** diff --git a/src/Illuminate/Cache/ArrayStore.php b/src/Illuminate/Cache/ArrayStore.php index 353552777462..1ebb54927611 100644 --- a/src/Illuminate/Cache/ArrayStore.php +++ b/src/Illuminate/Cache/ArrayStore.php @@ -24,22 +24,15 @@ class ArrayStore extends TaggableStore implements LockProvider */ public $locks = []; - /** - * Indicates if values are serialized within the store. - * - * @var bool - */ - protected $serializesValues; - /** * Create a new Array store. * * @param bool $serializesValues * @return void */ - public function __construct($serializesValues = false) - { - $this->serializesValues = $serializesValues; + public function __construct( + protected $serializesValues = false, + ) { } /** diff --git a/src/Illuminate/Cache/CacheManager.php b/src/Illuminate/Cache/CacheManager.php index 5ae5b6a3358b..179bf2ec1a65 100755 --- a/src/Illuminate/Cache/CacheManager.php +++ b/src/Illuminate/Cache/CacheManager.php @@ -16,13 +16,6 @@ */ class CacheManager implements FactoryContract { - /** - * The application instance. - * - * @var \Illuminate\Contracts\Foundation\Application - */ - protected $app; - /** * The array of resolved cache stores. * @@ -43,9 +36,9 @@ class CacheManager implements FactoryContract * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ - public function __construct($app) - { - $this->app = $app; + public function __construct( + protected $app, + ) { } /** diff --git a/src/Illuminate/Cache/Console/ClearCommand.php b/src/Illuminate/Cache/Console/ClearCommand.php index 23870d4db6be..8e0d06b7e807 100755 --- a/src/Illuminate/Cache/Console/ClearCommand.php +++ b/src/Illuminate/Cache/Console/ClearCommand.php @@ -26,20 +26,6 @@ class ClearCommand extends Command */ protected $description = 'Flush the application cache'; - /** - * The cache manager instance. - * - * @var \Illuminate\Cache\CacheManager - */ - protected $cache; - - /** - * The filesystem instance. - * - * @var \Illuminate\Filesystem\Filesystem - */ - protected $files; - /** * Create a new cache clear command instance. * @@ -47,12 +33,11 @@ class ClearCommand extends Command * @param \Illuminate\Filesystem\Filesystem $files * @return void */ - public function __construct(CacheManager $cache, Filesystem $files) - { + public function __construct( + protected CacheManager $cache, + protected Filesystem $files, + ) { parent::__construct(); - - $this->cache = $cache; - $this->files = $files; } /** diff --git a/src/Illuminate/Cache/Console/ForgetCommand.php b/src/Illuminate/Cache/Console/ForgetCommand.php index 7f418afbfaac..b0e3f1921ae8 100755 --- a/src/Illuminate/Cache/Console/ForgetCommand.php +++ b/src/Illuminate/Cache/Console/ForgetCommand.php @@ -23,24 +23,16 @@ class ForgetCommand extends Command */ protected $description = 'Remove an item from the cache'; - /** - * The cache manager instance. - * - * @var \Illuminate\Cache\CacheManager - */ - protected $cache; - /** * Create a new cache clear command instance. * * @param \Illuminate\Cache\CacheManager $cache * @return void */ - public function __construct(CacheManager $cache) - { + public function __construct( + protected CacheManager $cache, + ) { parent::__construct(); - - $this->cache = $cache; } /** diff --git a/src/Illuminate/Cache/RateLimiter.php b/src/Illuminate/Cache/RateLimiter.php index 8d8afe30a14c..3c19b1ddb264 100644 --- a/src/Illuminate/Cache/RateLimiter.php +++ b/src/Illuminate/Cache/RateLimiter.php @@ -13,13 +13,6 @@ class RateLimiter { use InteractsWithTime; - /** - * The cache store implementation. - * - * @var \Illuminate\Contracts\Cache\Repository - */ - protected $cache; - /** * The configured limit object resolvers. * @@ -33,9 +26,9 @@ class RateLimiter * @param \Illuminate\Contracts\Cache\Repository $cache * @return void */ - public function __construct(Cache $cache) - { - $this->cache = $cache; + public function __construct( + protected Cache $cache, + ) { } /** diff --git a/src/Illuminate/Cache/Repository.php b/src/Illuminate/Cache/Repository.php index a01f4aedb209..92ce4e3ddab0 100755 --- a/src/Illuminate/Cache/Repository.php +++ b/src/Illuminate/Cache/Repository.php @@ -36,13 +36,6 @@ class Repository implements ArrayAccess, CacheContract __call as macroCall; } - /** - * The cache store implementation. - * - * @var \Illuminate\Contracts\Cache\Store - */ - protected $store; - /** * The event dispatcher implementation. * @@ -57,13 +50,6 @@ class Repository implements ArrayAccess, CacheContract */ protected $default = 3600; - /** - * The cache store configuration options. - * - * @var array - */ - protected $config = []; - /** * Create a new cache repository instance. * @@ -71,10 +57,10 @@ class Repository implements ArrayAccess, CacheContract * @param array $config * @return void */ - public function __construct(Store $store, array $config = []) - { - $this->store = $store; - $this->config = $config; + public function __construct( + protected Store $store, + protected array $config = [], + ) { } /** diff --git a/src/Illuminate/Cache/TagSet.php b/src/Illuminate/Cache/TagSet.php index 471dc679ce5f..c3df8ede4144 100644 --- a/src/Illuminate/Cache/TagSet.php +++ b/src/Illuminate/Cache/TagSet.php @@ -6,20 +6,6 @@ class TagSet { - /** - * The cache store implementation. - * - * @var \Illuminate\Contracts\Cache\Store - */ - protected $store; - - /** - * The tag names. - * - * @var array - */ - protected $names = []; - /** * Create a new TagSet instance. * @@ -27,10 +13,10 @@ class TagSet * @param array $names * @return void */ - public function __construct(Store $store, array $names = []) - { - $this->store = $store; - $this->names = $names; + public function __construct( + protected Store $store, + protected array $names = [], + ) { } /** diff --git a/src/Illuminate/Http/Client/Request.php b/src/Illuminate/Http/Client/Request.php index 7c0132a35f85..1133b8576238 100644 --- a/src/Illuminate/Http/Client/Request.php +++ b/src/Illuminate/Http/Client/Request.php @@ -12,13 +12,6 @@ class Request implements ArrayAccess { use Macroable; - /** - * The underlying PSR request. - * - * @var \Psr\Http\Message\RequestInterface - */ - protected $request; - /** * The decoded payload for the request. * @@ -32,9 +25,9 @@ class Request implements ArrayAccess * @param \Psr\Http\Message\RequestInterface $request * @return void */ - public function __construct($request) - { - $this->request = $request; + public function __construct( + protected $request, + ) { } /** diff --git a/src/Illuminate/Http/Client/Response.php b/src/Illuminate/Http/Client/Response.php index 491eecf081fd..e7f8c7d8549a 100644 --- a/src/Illuminate/Http/Client/Response.php +++ b/src/Illuminate/Http/Client/Response.php @@ -19,13 +19,6 @@ class Response implements ArrayAccess, Stringable __call as macroCall; } - /** - * The underlying PSR response. - * - * @var \Psr\Http\Message\ResponseInterface - */ - protected $response; - /** * The decoded JSON response. * @@ -53,9 +46,9 @@ class Response implements ArrayAccess, Stringable * @param \Psr\Http\Message\MessageInterface $response * @return void */ - public function __construct($response) - { - $this->response = $response; + public function __construct( + protected $response, + ) { } /** diff --git a/src/Illuminate/Http/Client/ResponseSequence.php b/src/Illuminate/Http/Client/ResponseSequence.php index e35736b05d99..91377edb8e08 100644 --- a/src/Illuminate/Http/Client/ResponseSequence.php +++ b/src/Illuminate/Http/Client/ResponseSequence.php @@ -10,13 +10,6 @@ class ResponseSequence { use Macroable; - /** - * The responses in the sequence. - * - * @var array - */ - protected $responses; - /** * Indicates that invoking this sequence when it is empty should throw an exception. * @@ -37,9 +30,9 @@ class ResponseSequence * @param array $responses * @return void */ - public function __construct(array $responses) - { - $this->responses = $responses; + public function __construct( + protected array $responses, + ) { } /** diff --git a/src/Illuminate/Http/Middleware/HandleCors.php b/src/Illuminate/Http/Middleware/HandleCors.php index eee030511e39..1587199734f7 100644 --- a/src/Illuminate/Http/Middleware/HandleCors.php +++ b/src/Illuminate/Http/Middleware/HandleCors.php @@ -9,20 +9,6 @@ class HandleCors { - /** - * The container instance. - * - * @var \Illuminate\Contracts\Container\Container - */ - protected $container; - - /** - * The CORS service instance. - * - * @var \Fruitcake\Cors\CorsService - */ - protected $cors; - /** * Create a new middleware instance. * @@ -30,10 +16,10 @@ class HandleCors * @param \Fruitcake\Cors\CorsService $cors * @return void */ - public function __construct(Container $container, CorsService $cors) - { - $this->container = $container; - $this->cors = $cors; + public function __construct( + protected Container $container, + protected CorsService $cors, + ) { } /** diff --git a/src/Illuminate/Http/Middleware/TrustHosts.php b/src/Illuminate/Http/Middleware/TrustHosts.php index 8eae16d1cec0..f5414e8ee7bb 100644 --- a/src/Illuminate/Http/Middleware/TrustHosts.php +++ b/src/Illuminate/Http/Middleware/TrustHosts.php @@ -7,13 +7,6 @@ class TrustHosts { - /** - * The application instance. - * - * @var \Illuminate\Contracts\Foundation\Application - */ - protected $app; - /** * The trusted hosts that have been configured to always be trusted. * @@ -34,9 +27,9 @@ class TrustHosts * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ - public function __construct(Application $app) - { - $this->app = $app; + public function __construct( + protected Application $app, + ) { } /** diff --git a/src/Illuminate/Http/Resources/Json/JsonResource.php b/src/Illuminate/Http/Resources/Json/JsonResource.php index 30b9425b08fb..34a3e24bceb6 100644 --- a/src/Illuminate/Http/Resources/Json/JsonResource.php +++ b/src/Illuminate/Http/Resources/Json/JsonResource.php @@ -19,13 +19,6 @@ class JsonResource implements ArrayAccess, JsonSerializable, Responsable, UrlRou { use ConditionallyLoadsAttributes, DelegatesToResource; - /** - * The resource instance. - * - * @var mixed - */ - public $resource; - /** * The additional data that should be added to the top-level resource array. * @@ -55,9 +48,9 @@ class JsonResource implements ArrayAccess, JsonSerializable, Responsable, UrlRou * @param mixed $resource * @return void */ - public function __construct($resource) - { - $this->resource = $resource; + public function __construct( + public $resource, + ) { } /** diff --git a/src/Illuminate/Http/Resources/Json/ResourceResponse.php b/src/Illuminate/Http/Resources/Json/ResourceResponse.php index 430e41a72950..706d0e866b04 100644 --- a/src/Illuminate/Http/Resources/Json/ResourceResponse.php +++ b/src/Illuminate/Http/Resources/Json/ResourceResponse.php @@ -8,22 +8,15 @@ class ResourceResponse implements Responsable { - /** - * The underlying resource. - * - * @var mixed - */ - public $resource; - /** * Create a new resource response. * * @param mixed $resource * @return void */ - public function __construct($resource) - { - $this->resource = $resource; + public function __construct( + public $resource, + ) { } /** diff --git a/src/Illuminate/Log/Context/Events/ContextDehydrating.php b/src/Illuminate/Log/Context/Events/ContextDehydrating.php index d074be069aed..bd22925c8578 100644 --- a/src/Illuminate/Log/Context/Events/ContextDehydrating.php +++ b/src/Illuminate/Log/Context/Events/ContextDehydrating.php @@ -4,20 +4,13 @@ class ContextDehydrating { - /** - * The context instance. - * - * @var \Illuminate\Log\Context\Repository - */ - public $context; - /** * Create a new event instance. * * @param \Illuminate\Log\Context\Repository $context */ - public function __construct($context) - { - $this->context = $context; + public function __construct( + public $context, + ) { } } diff --git a/src/Illuminate/Log/Context/Events/ContextHydrated.php b/src/Illuminate/Log/Context/Events/ContextHydrated.php index 42bd733a8c7b..7152a187a743 100644 --- a/src/Illuminate/Log/Context/Events/ContextHydrated.php +++ b/src/Illuminate/Log/Context/Events/ContextHydrated.php @@ -4,20 +4,13 @@ class ContextHydrated { - /** - * The context instance. - * - * @var \Illuminate\Log\Context\Repository - */ - public $context; - /** * Create a new event instance. * * @param \Illuminate\Log\Context\Repository $context */ - public function __construct($context) - { - $this->context = $context; + public function __construct( + public $context, + ) { } } diff --git a/src/Illuminate/Log/LogManager.php b/src/Illuminate/Log/LogManager.php index 7563e35cb837..7b048430c697 100644 --- a/src/Illuminate/Log/LogManager.php +++ b/src/Illuminate/Log/LogManager.php @@ -30,13 +30,6 @@ class LogManager implements LoggerInterface { use ParsesLogConfiguration; - /** - * The application instance. - * - * @var \Illuminate\Contracts\Foundation\Application - */ - protected $app; - /** * The array of resolved channels. * @@ -71,9 +64,9 @@ class LogManager implements LoggerInterface * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ - public function __construct($app) - { - $this->app = $app; + public function __construct( + protected $app, + ) { } /** diff --git a/src/Illuminate/Log/Logger.php b/src/Illuminate/Log/Logger.php index c94bf5bae249..990c58573dcb 100755 --- a/src/Illuminate/Log/Logger.php +++ b/src/Illuminate/Log/Logger.php @@ -15,20 +15,6 @@ class Logger implements LoggerInterface { use Conditionable; - /** - * The underlying logger implementation. - * - * @var \Psr\Log\LoggerInterface - */ - protected $logger; - - /** - * The event dispatcher instance. - * - * @var \Illuminate\Contracts\Events\Dispatcher|null - */ - protected $dispatcher; - /** * Any context to be added to logs. * @@ -43,10 +29,10 @@ class Logger implements LoggerInterface * @param \Illuminate\Contracts\Events\Dispatcher|null $dispatcher * @return void */ - public function __construct(LoggerInterface $logger, ?Dispatcher $dispatcher = null) - { - $this->logger = $logger; - $this->dispatcher = $dispatcher; + public function __construct( + protected LoggerInterface $logger, + protected ?Dispatcher $dispatcher = null, + ) { } /** diff --git a/src/Illuminate/Mail/PendingMail.php b/src/Illuminate/Mail/PendingMail.php index 1aa3d9a6cc2f..4a3af5f2b760 100644 --- a/src/Illuminate/Mail/PendingMail.php +++ b/src/Illuminate/Mail/PendingMail.php @@ -11,13 +11,6 @@ class PendingMail { use Conditionable; - /** - * The mailer instance. - * - * @var \Illuminate\Contracts\Mail\Mailer - */ - protected $mailer; - /** * The locale of the message. * @@ -52,9 +45,9 @@ class PendingMail * @param \Illuminate\Contracts\Mail\Mailer $mailer * @return void */ - public function __construct(MailerContract $mailer) - { - $this->mailer = $mailer; + public function __construct( + protected MailerContract $mailer, + ) { } /** diff --git a/src/Illuminate/Mail/SentMessage.php b/src/Illuminate/Mail/SentMessage.php index c33f87edc724..d1040b33eba2 100644 --- a/src/Illuminate/Mail/SentMessage.php +++ b/src/Illuminate/Mail/SentMessage.php @@ -13,22 +13,15 @@ class SentMessage { use ForwardsCalls; - /** - * The Symfony SentMessage instance. - * - * @var \Symfony\Component\Mailer\SentMessage - */ - protected $sentMessage; - /** * Create a new SentMessage instance. * * @param \Symfony\Component\Mailer\SentMessage $sentMessage * @return void */ - public function __construct(SymfonySentMessage $sentMessage) - { - $this->sentMessage = $sentMessage; + public function __construct( + protected SymfonySentMessage $sentMessage, + ) { } /** diff --git a/src/Illuminate/Mail/TextMessage.php b/src/Illuminate/Mail/TextMessage.php index 5c615d2cfe58..ef98206acd5e 100644 --- a/src/Illuminate/Mail/TextMessage.php +++ b/src/Illuminate/Mail/TextMessage.php @@ -11,22 +11,15 @@ class TextMessage { use ForwardsCalls; - /** - * The underlying message instance. - * - * @var \Illuminate\Mail\Message - */ - protected $message; - /** * Create a new text message instance. * * @param \Illuminate\Mail\Message $message * @return void */ - public function __construct($message) - { - $this->message = $message; + public function __construct( + protected $message, + ) { } /** diff --git a/src/Illuminate/Mail/Transport/LogTransport.php b/src/Illuminate/Mail/Transport/LogTransport.php index 2dff1490fea5..6bf7dc64596b 100644 --- a/src/Illuminate/Mail/Transport/LogTransport.php +++ b/src/Illuminate/Mail/Transport/LogTransport.php @@ -12,22 +12,15 @@ class LogTransport implements Stringable, TransportInterface { - /** - * The Logger instance. - * - * @var \Psr\Log\LoggerInterface - */ - protected $logger; - /** * Create a new log transport instance. * * @param \Psr\Log\LoggerInterface $logger * @return void */ - public function __construct(LoggerInterface $logger) - { - $this->logger = $logger; + public function __construct( + protected LoggerInterface $logger, + ) { } /** diff --git a/src/Illuminate/View/Engines/FileEngine.php b/src/Illuminate/View/Engines/FileEngine.php index 992f6758d980..d08331cae10d 100644 --- a/src/Illuminate/View/Engines/FileEngine.php +++ b/src/Illuminate/View/Engines/FileEngine.php @@ -7,22 +7,15 @@ class FileEngine implements Engine { - /** - * The filesystem instance. - * - * @var \Illuminate\Filesystem\Filesystem - */ - protected $files; - /** * Create a new file engine instance. * * @param \Illuminate\Filesystem\Filesystem $files * @return void */ - public function __construct(Filesystem $files) - { - $this->files = $files; + public function __construct( + protected Filesystem $files, + ) { } /** diff --git a/src/Illuminate/View/Engines/PhpEngine.php b/src/Illuminate/View/Engines/PhpEngine.php index 13525aeeab53..8342c341ec54 100755 --- a/src/Illuminate/View/Engines/PhpEngine.php +++ b/src/Illuminate/View/Engines/PhpEngine.php @@ -8,22 +8,15 @@ class PhpEngine implements Engine { - /** - * The filesystem instance. - * - * @var \Illuminate\Filesystem\Filesystem - */ - protected $files; - /** * Create a new file engine instance. * * @param \Illuminate\Filesystem\Filesystem $files * @return void */ - public function __construct(Filesystem $files) - { - $this->files = $files; + public function __construct( + protected Filesystem $files, + ) { } /** diff --git a/src/Illuminate/View/Middleware/ShareErrorsFromSession.php b/src/Illuminate/View/Middleware/ShareErrorsFromSession.php index 64015d58678c..473d175d4e84 100644 --- a/src/Illuminate/View/Middleware/ShareErrorsFromSession.php +++ b/src/Illuminate/View/Middleware/ShareErrorsFromSession.php @@ -8,22 +8,15 @@ class ShareErrorsFromSession { - /** - * The view factory implementation. - * - * @var \Illuminate\Contracts\View\Factory - */ - protected $view; - /** * Create a new error binder instance. * * @param \Illuminate\Contracts\View\Factory $view * @return void */ - public function __construct(ViewFactory $view) - { - $this->view = $view; + public function __construct( + protected ViewFactory $view + ) { } /**