diff --git a/app/Events/ArticleWasApproved.php b/app/Events/ArticleWasApproved.php index 47ecbef1a..b874e6c63 100644 --- a/app/Events/ArticleWasApproved.php +++ b/app/Events/ArticleWasApproved.php @@ -9,10 +9,8 @@ final class ArticleWasApproved { use SerializesModels; - public $article; - - public function __construct(Article $article) - { - $this->article = $article; + public function __construct( + public Article $article + ) { } } diff --git a/app/Events/ArticleWasSubmittedForApproval.php b/app/Events/ArticleWasSubmittedForApproval.php index 901096650..7074c2afb 100644 --- a/app/Events/ArticleWasSubmittedForApproval.php +++ b/app/Events/ArticleWasSubmittedForApproval.php @@ -9,10 +9,8 @@ class ArticleWasSubmittedForApproval { use SerializesModels; - public $article; - - public function __construct(Article $article) - { - $this->article = $article; + public function __construct( + public Article $article + ) { } } diff --git a/app/Events/EmailAddressWasChanged.php b/app/Events/EmailAddressWasChanged.php index e5b96d1ce..1f9903e90 100644 --- a/app/Events/EmailAddressWasChanged.php +++ b/app/Events/EmailAddressWasChanged.php @@ -11,13 +11,8 @@ class EmailAddressWasChanged use Dispatchable; use SerializesModels; - /** - * @var \App\Models\User - */ - public $user; - - public function __construct(User $user) - { - $this->user = $user; + public function __construct( + public User $user + ) { } } diff --git a/app/Events/ReplyWasCreated.php b/app/Events/ReplyWasCreated.php index c091f63b6..2f4b9b9ee 100644 --- a/app/Events/ReplyWasCreated.php +++ b/app/Events/ReplyWasCreated.php @@ -9,13 +9,8 @@ final class ReplyWasCreated { use SerializesModels; - /** - * @var \App\Models\Reply - */ - public $reply; - - public function __construct(Reply $reply) - { - $this->reply = $reply; + public function __construct( + public Reply $reply + ) { } } diff --git a/app/Jobs/ApproveArticle.php b/app/Jobs/ApproveArticle.php index 8b4f1b62f..c5afc8d95 100644 --- a/app/Jobs/ApproveArticle.php +++ b/app/Jobs/ApproveArticle.php @@ -8,11 +8,9 @@ final class ApproveArticle { - private $article; - - public function __construct(Article $article) - { - $this->article = $article; + public function __construct( + private Article $article + ) { } public function handle(): Article diff --git a/app/Jobs/BanUser.php b/app/Jobs/BanUser.php index 416bd58c5..47578fbb6 100644 --- a/app/Jobs/BanUser.php +++ b/app/Jobs/BanUser.php @@ -7,14 +7,9 @@ final class BanUser { - /** - * @var \App\Models\User - */ - private $user; - - public function __construct(User $user) - { - $this->user = $user; + public function __construct( + private User $user + ) { } public function handle(): User diff --git a/app/Jobs/CreateArticle.php b/app/Jobs/CreateArticle.php index 235169ee8..3a646fb52 100644 --- a/app/Jobs/CreateArticle.php +++ b/app/Jobs/CreateArticle.php @@ -9,24 +9,17 @@ final class CreateArticle { - private $title; - - private $body; - - private $author; - - private $shouldBeSubmitted; - private $originalUrl; private $tags; - public function __construct(string $title, string $body, User $author, bool $shouldBeSubmitted, array $options = []) - { - $this->title = $title; - $this->body = $body; - $this->author = $author; - $this->shouldBeSubmitted = $shouldBeSubmitted; + public function __construct( + private string $title, + private string $body, + private User $author, + private bool $shouldBeSubmitted, + array $options = [] + ) { $this->originalUrl = $options['original_url'] ?? null; $this->tags = $options['tags'] ?? []; } diff --git a/app/Jobs/CreateReply.php b/app/Jobs/CreateReply.php index 7dfdad5a4..7c5232ce1 100644 --- a/app/Jobs/CreateReply.php +++ b/app/Jobs/CreateReply.php @@ -13,26 +13,11 @@ final class CreateReply { - /** - * @var string - */ - private $body; - - /** - * @var \App\Models\User - */ - private $author; - - /** - * @var \App\Models\ReplyAble - */ - private $replyAble; - - public function __construct(string $body, User $author, ReplyAble $replyAble) - { - $this->body = $body; - $this->author = $author; - $this->replyAble = $replyAble; + public function __construct( + private string $body, + private User $author, + private ReplyAble $replyAble + ) { } public static function fromRequest(CreateReplyRequest $request): self diff --git a/app/Jobs/CreateThread.php b/app/Jobs/CreateThread.php index 319bae675..9e66e0a96 100644 --- a/app/Jobs/CreateThread.php +++ b/app/Jobs/CreateThread.php @@ -10,32 +10,12 @@ final class CreateThread { - /** - * @var string - */ - private $subject; - - /** - * @var string - */ - private $body; - - /** - * @var \App\Models\User - */ - private $author; - - /** - * @var array - */ - private $tags; - - public function __construct(string $subject, string $body, User $author, array $tags = []) - { - $this->subject = $subject; - $this->body = $body; - $this->author = $author; - $this->tags = $tags; + public function __construct( + private string $subject, + private string $body, + private User $author, + private array $tags = [] + ) { } public static function fromRequest(ThreadRequest $request): self diff --git a/app/Jobs/DeclineArticle.php b/app/Jobs/DeclineArticle.php index 8a1bb14dd..2c667af58 100644 --- a/app/Jobs/DeclineArticle.php +++ b/app/Jobs/DeclineArticle.php @@ -6,11 +6,9 @@ final class DeclineArticle { - private Article $article; - - public function __construct(Article $article) - { - $this->article = $article; + public function __construct( + private Article $article + ) { } public function handle(): void diff --git a/app/Jobs/DeleteArticle.php b/app/Jobs/DeleteArticle.php index 323516a60..3e1582855 100644 --- a/app/Jobs/DeleteArticle.php +++ b/app/Jobs/DeleteArticle.php @@ -6,11 +6,9 @@ final class DeleteArticle { - private $article; - - public function __construct(Article $article) - { - $this->article = $article; + public function __construct( + private Article $article + ) { } public function handle() diff --git a/app/Jobs/DeleteReply.php b/app/Jobs/DeleteReply.php index b80644ed1..1874e82aa 100644 --- a/app/Jobs/DeleteReply.php +++ b/app/Jobs/DeleteReply.php @@ -6,14 +6,9 @@ final class DeleteReply { - /** - * @var \App\Models\Reply - */ - private $reply; - - public function __construct(Reply $reply) - { - $this->reply = $reply; + public function __construct( + private Reply $reply + ) { } public function handle() diff --git a/app/Jobs/DeleteThread.php b/app/Jobs/DeleteThread.php index c3b73e03e..7a4cc4942 100644 --- a/app/Jobs/DeleteThread.php +++ b/app/Jobs/DeleteThread.php @@ -6,14 +6,9 @@ final class DeleteThread { - /** - * @var \App\Models\Thread - */ - private $thread; - - public function __construct(Thread $thread) - { - $this->thread = $thread; + public function __construct( + private Thread $thread + ) { } public function handle() diff --git a/app/Jobs/DeleteUser.php b/app/Jobs/DeleteUser.php index 4b6e6b927..04d8bce80 100644 --- a/app/Jobs/DeleteUser.php +++ b/app/Jobs/DeleteUser.php @@ -6,14 +6,9 @@ final class DeleteUser { - /** - * @var \App\Models\User - */ - private $user; - - public function __construct(User $user) - { - $this->user = $user; + public function __construct( + private User $user + ) { } public function handle() diff --git a/app/Jobs/DisapproveArticle.php b/app/Jobs/DisapproveArticle.php index 0d62b7e26..ad3dabeeb 100644 --- a/app/Jobs/DisapproveArticle.php +++ b/app/Jobs/DisapproveArticle.php @@ -6,14 +6,9 @@ final class DisapproveArticle { - /** - * @var \App\Models\Article - */ - private $article; - - public function __construct(Article $article) - { - $this->article = $article; + public function __construct( + private Article $article + ) { } public function handle(): Article diff --git a/app/Jobs/GenerateSocialShareImage.php b/app/Jobs/GenerateSocialShareImage.php index c99b5dbcd..c171a0b84 100644 --- a/app/Jobs/GenerateSocialShareImage.php +++ b/app/Jobs/GenerateSocialShareImage.php @@ -7,11 +7,6 @@ final class GenerateSocialShareImage { - /** - * @var \App\Models\Thread - */ - private $article; - const TEXT_X_POSITION = 50; const TEXT_Y_POSITION = 100; @@ -28,9 +23,9 @@ final class GenerateSocialShareImage const CACHE_LIFETIME = 43200; - public function __construct(Article $article) - { - $this->article = $article; + public function __construct( + private Article $article + ) { } public function handle(ImageManager $image) diff --git a/app/Jobs/LikeArticle.php b/app/Jobs/LikeArticle.php index a330500eb..78da5c4e7 100644 --- a/app/Jobs/LikeArticle.php +++ b/app/Jobs/LikeArticle.php @@ -8,20 +8,10 @@ final class LikeArticle { - /** - * @var \App\Models\Article - */ - private $article; - - /** - * @var \App\Models\User - */ - private $user; - - public function __construct(Article $article, User $user) - { - $this->article = $article; - $this->user = $user; + public function __construct( + private Article $article, + private User $user + ) { } /** diff --git a/app/Jobs/LikeReply.php b/app/Jobs/LikeReply.php index 86640f96f..0335bc702 100644 --- a/app/Jobs/LikeReply.php +++ b/app/Jobs/LikeReply.php @@ -8,20 +8,10 @@ final class LikeReply { - /** - * @var \App\Models\Reply - */ - private $reply; - - /** - * @var \App\Models\User - */ - private $user; - - public function __construct(Reply $reply, User $user) - { - $this->reply = $reply; - $this->user = $user; + public function __construct( + private Reply $reply, + private User $user + ) { } /** diff --git a/app/Jobs/LikeThread.php b/app/Jobs/LikeThread.php index 7dac86f3d..093e702aa 100644 --- a/app/Jobs/LikeThread.php +++ b/app/Jobs/LikeThread.php @@ -8,20 +8,10 @@ final class LikeThread { - /** - * @var \App\Models\Thread - */ - private $thread; - - /** - * @var \App\Models\User - */ - private $user; - - public function __construct(Thread $thread, User $user) - { - $this->thread = $thread; - $this->user = $user; + public function __construct( + private Thread $thread, + private User $user + ) { } /** diff --git a/app/Jobs/MarkThreadSolution.php b/app/Jobs/MarkThreadSolution.php index 9a341a422..c99b7a461 100644 --- a/app/Jobs/MarkThreadSolution.php +++ b/app/Jobs/MarkThreadSolution.php @@ -8,26 +8,11 @@ final class MarkThreadSolution { - /** - * @var \App\Models\Thread - */ - private $thread; - - /** - * @var \App\Models\Reply - */ - private $solution; - - /** - * @var \App\Models\User - */ - private $user; - - public function __construct(Thread $thread, Reply $solution, User $user) - { - $this->thread = $thread; - $this->solution = $solution; - $this->user = $user; + public function __construct( + private Thread $thread, + private Reply $solution, + private User $user + ) { } public function handle() diff --git a/app/Jobs/RegisterUser.php b/app/Jobs/RegisterUser.php index 785983caf..75a2299ef 100644 --- a/app/Jobs/RegisterUser.php +++ b/app/Jobs/RegisterUser.php @@ -9,38 +9,13 @@ final class RegisterUser { - /** - * @var string - */ - private $name; - - /** - * @var string - */ - private $email; - - /** - * @var string - */ - private $username; - - /** - * @var string - */ - private $githubId; - - /** - * @var string - */ - private $githubUsername; - - public function __construct(string $name, string $email, string $username, string $githubId, string $githubUsername) - { - $this->name = $name; - $this->email = $email; - $this->username = $username; - $this->githubId = $githubId; - $this->githubUsername = $githubUsername; + public function __construct( + private string $name, + private string $email, + private string $username, + private string $githubId, + private string $githubUsername + ) { } public static function fromRequest(RegisterRequest $request): self diff --git a/app/Jobs/SubscribeToSubscriptionAble.php b/app/Jobs/SubscribeToSubscriptionAble.php index 1b47aece9..3aa5c254d 100644 --- a/app/Jobs/SubscribeToSubscriptionAble.php +++ b/app/Jobs/SubscribeToSubscriptionAble.php @@ -9,20 +9,10 @@ final class SubscribeToSubscriptionAble { - /** - * @var \App\Models\User - */ - private $user; - - /** - * @var \App\Models\SubscriptionAble - */ - private $subscriptionAble; - - public function __construct(User $user, SubscriptionAble $subscriptionAble) - { - $this->user = $user; - $this->subscriptionAble = $subscriptionAble; + public function __construct( + private User $user, + private SubscriptionAble $subscriptionAble + ) { } public function handle() diff --git a/app/Jobs/UnbanUser.php b/app/Jobs/UnbanUser.php index a085ba393..aa940cd41 100644 --- a/app/Jobs/UnbanUser.php +++ b/app/Jobs/UnbanUser.php @@ -6,14 +6,9 @@ final class UnbanUser { - /** - * @var \App\Models\User - */ - private $user; - - public function __construct(User $user) - { - $this->user = $user; + public function __construct( + private User $user + ) { } public function handle(): User diff --git a/app/Jobs/UnlikeArticle.php b/app/Jobs/UnlikeArticle.php index 57d08ae07..98d649e9d 100644 --- a/app/Jobs/UnlikeArticle.php +++ b/app/Jobs/UnlikeArticle.php @@ -7,20 +7,10 @@ final class UnlikeArticle { - /** - * @var \App\Models\Article - */ - private $article; - - /** - * @var \App\Models\User - */ - private $user; - - public function __construct(Article $article, User $user) - { - $this->article = $article; - $this->user = $user; + public function __construct( + private Article $article, + private User $user + ) { } public function handle(): void diff --git a/app/Jobs/UnlikeReply.php b/app/Jobs/UnlikeReply.php index 68d6045b9..bc73f6c0a 100644 --- a/app/Jobs/UnlikeReply.php +++ b/app/Jobs/UnlikeReply.php @@ -7,20 +7,10 @@ final class UnlikeReply { - /** - * @var \App\Models\Reply - */ - private $reply; - - /** - * @var \App\Models\User - */ - private $user; - - public function __construct(Reply $reply, User $user) - { - $this->reply = $reply; - $this->user = $user; + public function __construct( + private Reply $reply, + private User $user + ) { } public function handle(): void diff --git a/app/Jobs/UnlikeThread.php b/app/Jobs/UnlikeThread.php index 3179e8d2b..c0adbb7d1 100644 --- a/app/Jobs/UnlikeThread.php +++ b/app/Jobs/UnlikeThread.php @@ -7,20 +7,10 @@ final class UnlikeThread { - /** - * @var \App\Models\Thread - */ - private $thread; - - /** - * @var \App\Models\User - */ - private $user; - - public function __construct(Thread $thread, User $user) - { - $this->thread = $thread; - $this->user = $user; + public function __construct( + private Thread $thread, + private User $user + ) { } public function handle(): void diff --git a/app/Jobs/UnmarkThreadSolution.php b/app/Jobs/UnmarkThreadSolution.php index 8a4ec7edd..22769ee58 100644 --- a/app/Jobs/UnmarkThreadSolution.php +++ b/app/Jobs/UnmarkThreadSolution.php @@ -6,14 +6,9 @@ final class UnmarkThreadSolution { - /** - * @var \App\Models\Thread - */ - private $thread; - - public function __construct(Thread $thread) - { - $this->thread = $thread; + public function __construct( + private Thread $thread + ) { } public function handle() diff --git a/app/Jobs/UnsubscribeFromSubscriptionAble.php b/app/Jobs/UnsubscribeFromSubscriptionAble.php index 7fe705434..4e9ed287d 100644 --- a/app/Jobs/UnsubscribeFromSubscriptionAble.php +++ b/app/Jobs/UnsubscribeFromSubscriptionAble.php @@ -7,20 +7,10 @@ final class UnsubscribeFromSubscriptionAble { - /** - * @var \App\Models\User - */ - private $user; - - /** - * @var \App\Models\SubscriptionAble - */ - private $subscriptionAble; - - public function __construct(User $user, SubscriptionAble $subscriptionAble) - { - $this->user = $user; - $this->subscriptionAble = $subscriptionAble; + public function __construct( + private User $user, + private SubscriptionAble $subscriptionAble + ) { } public function handle() diff --git a/app/Jobs/UpdateArticle.php b/app/Jobs/UpdateArticle.php index 462e26cea..5f498fa3b 100644 --- a/app/Jobs/UpdateArticle.php +++ b/app/Jobs/UpdateArticle.php @@ -8,24 +8,17 @@ final class UpdateArticle { - private $article; - - private $title; - - private $body; - - private $shouldBeSubmitted; - private $originalUrl; private $tags; - public function __construct(Article $article, string $title, string $body, bool $shouldBeSubmitted, array $options = []) - { - $this->article = $article; - $this->title = $title; - $this->body = $body; - $this->shouldBeSubmitted = $shouldBeSubmitted; + public function __construct( + private Article $article, + private string $title, + private string $body, + private bool $shouldBeSubmitted, + array $options = [] + ) { $this->originalUrl = $options['original_url'] ?? null; $this->tags = $options['tags'] ?? []; } diff --git a/app/Jobs/UpdatePassword.php b/app/Jobs/UpdatePassword.php index d5b2b9483..6eed5ee7b 100644 --- a/app/Jobs/UpdatePassword.php +++ b/app/Jobs/UpdatePassword.php @@ -7,20 +7,10 @@ final class UpdatePassword { - /** - * @var \App\Models\User - */ - private $user; - - /** - * @var string - */ - private $newPassword; - - public function __construct(User $user, string $newPassword) - { - $this->user = $user; - $this->newPassword = $newPassword; + public function __construct( + private User $user, + private string $newPassword + ) { } public function handle(Hasher $hasher) diff --git a/app/Jobs/UpdateProfile.php b/app/Jobs/UpdateProfile.php index 541a900f7..5e34c2473 100644 --- a/app/Jobs/UpdateProfile.php +++ b/app/Jobs/UpdateProfile.php @@ -9,19 +9,12 @@ final class UpdateProfile { - /** - * @var \App\Models\User - */ - private $user; + private array $attributes; - /** - * @var array - */ - private $attributes; - - public function __construct(User $user, array $attributes = []) - { - $this->user = $user; + public function __construct( + private User $user, + array $attributes = [] + ) { $this->attributes = Arr::only($attributes, ['name', 'email', 'username', 'github_username', 'bio', 'twitter']); } diff --git a/app/Jobs/UpdateReply.php b/app/Jobs/UpdateReply.php index 7d04a2b79..9c7ffe8b1 100644 --- a/app/Jobs/UpdateReply.php +++ b/app/Jobs/UpdateReply.php @@ -7,26 +7,11 @@ final class UpdateReply { - /** - * @var Reply - */ - private $reply; - - /** - * @var User - */ - private $updatedBy; - - /** - * @var string - */ - private $body; - - public function __construct(Reply $reply, User $updatedBy, string $body) - { - $this->reply = $reply; - $this->updatedBy = $updatedBy; - $this->body = $body; + public function __construct( + private Reply $reply, + private User $updatedBy, + private string $body + ) { } public function handle() diff --git a/app/Jobs/UpdateThread.php b/app/Jobs/UpdateThread.php index 0f16aca45..de0884b72 100644 --- a/app/Jobs/UpdateThread.php +++ b/app/Jobs/UpdateThread.php @@ -9,25 +9,13 @@ final class UpdateThread { - /** - * @var Thread - */ - private $thread; - - /** - * @var User - */ - private $updatedBy; - - /** - * @var array - */ - private $attributes; - - public function __construct(Thread $thread, User $updatedBy, array $attributes = []) - { - $this->thread = $thread; - $this->updatedBy = $updatedBy; + private array $attributes; + + public function __construct( + private Thread $thread, + private User $updatedBy, + array $attributes = [] + ) { $this->attributes = Arr::only($attributes, ['subject', 'body', 'slug', 'tags']); } diff --git a/app/Mail/ArticleApprovedEmail.php b/app/Mail/ArticleApprovedEmail.php index 87a1c22a2..a0f1548a4 100644 --- a/app/Mail/ArticleApprovedEmail.php +++ b/app/Mail/ArticleApprovedEmail.php @@ -7,13 +7,11 @@ final class ArticleApprovedEmail extends Mailable { - public $article; - public $subscription; - public function __construct(Article $article) - { - $this->article = $article; + public function __construct( + public Article $article + ) { } public function build() diff --git a/app/Mail/NewReplyEmail.php b/app/Mail/NewReplyEmail.php index 11eecf0b2..2cfd6c670 100644 --- a/app/Mail/NewReplyEmail.php +++ b/app/Mail/NewReplyEmail.php @@ -4,37 +4,20 @@ use App\Models\Reply; use App\Models\Subscription; +use App\Models\Thread; use App\Models\User; use Illuminate\Mail\Mailable; final class NewReplyEmail extends Mailable { - /** - * @var \App\Models\Thread - */ - public $thread; + public Thread $thread; - /** - * @var \App\Models\Reply - */ - public $reply; - - /** - * @var \App\Models\Subscription - */ - public $subscription; - - /** - * @var \App\Models\User - */ - public $receiver; - - public function __construct(Reply $reply, Subscription $subscription, User $receiver) - { + public function __construct( + public Reply $reply, + public Subscription $subscription, + public User $receiver + ) { $this->thread = $reply->replyAble(); - $this->reply = $reply; - $this->subscription = $subscription; - $this->receiver = $receiver; } public function build() diff --git a/app/Markdown/LeagueConverter.php b/app/Markdown/LeagueConverter.php index a1202d018..e4f50e420 100644 --- a/app/Markdown/LeagueConverter.php +++ b/app/Markdown/LeagueConverter.php @@ -6,11 +6,9 @@ final class LeagueConverter implements Converter { - private CommonMarkConverter $converter; - - public function __construct(CommonMarkConverter $converter) - { - $this->converter = $converter; + public function __construct( + private CommonMarkConverter $converter + ) { } public function toHtml(string $markdown): string diff --git a/app/Notifications/ArticleApprovedNotification.php b/app/Notifications/ArticleApprovedNotification.php index b9bbf015f..16073944f 100644 --- a/app/Notifications/ArticleApprovedNotification.php +++ b/app/Notifications/ArticleApprovedNotification.php @@ -13,11 +13,9 @@ final class ArticleApprovedNotification extends Notification implements ShouldQu { use Queueable; - public $article; - - public function __construct(Article $article) - { - $this->article = $article; + public function __construct( + public Article $article + ) { } public function via(User $user) diff --git a/app/Notifications/ArticleSubmitted.php b/app/Notifications/ArticleSubmitted.php index 89b4235fa..48d5ebb69 100644 --- a/app/Notifications/ArticleSubmitted.php +++ b/app/Notifications/ArticleSubmitted.php @@ -12,11 +12,9 @@ class ArticleSubmitted extends Notification implements ShouldQueue { use Queueable; - private Article $article; - - public function __construct(Article $article) - { - $this->article = $article; + public function __construct( + private Article $article + ) { } public function via($notifiable) diff --git a/app/Notifications/NewReplyNotification.php b/app/Notifications/NewReplyNotification.php index 5233a32d0..290f10598 100644 --- a/app/Notifications/NewReplyNotification.php +++ b/app/Notifications/NewReplyNotification.php @@ -14,20 +14,10 @@ final class NewReplyNotification extends Notification implements ShouldQueue { use Queueable; - /** - * @var \App\Models\Reply - */ - public $reply; - - /** - * @var \App\Models\Subscription - */ - public $subscription; - - public function __construct(Reply $reply, Subscription $subscription) - { - $this->reply = $reply; - $this->subscription = $subscription; + public function __construct( + public Reply $reply, + public Subscription $subscription + ) { } public function via(User $user) diff --git a/app/Notifications/PostArticleToTwitter.php b/app/Notifications/PostArticleToTwitter.php index 752ebb202..4a6048204 100644 --- a/app/Notifications/PostArticleToTwitter.php +++ b/app/Notifications/PostArticleToTwitter.php @@ -12,11 +12,9 @@ class PostArticleToTwitter extends Notification { use Queueable; - private $article; - - public function __construct(Article $article) - { - $this->article = $article; + public function __construct( + private Article $article + ) { } public function via($notifiable) diff --git a/app/Social/GithubUser.php b/app/Social/GithubUser.php index 05f47a581..63e8203ed 100644 --- a/app/Social/GithubUser.php +++ b/app/Social/GithubUser.php @@ -8,14 +8,9 @@ final class GithubUser implements Arrayable { - /** - * @var array - */ - private $attributes; - - public function __construct(array $attributes) - { - $this->attributes = $attributes; + public function __construct( + private array $attributes + ) { } public function isTooYoung(): bool diff --git a/app/View/Components/Modal.php b/app/View/Components/Modal.php index 09180aebf..d3524ed84 100644 --- a/app/View/Components/Modal.php +++ b/app/View/Components/Modal.php @@ -6,22 +6,15 @@ class Modal extends Component { - public $identifier; - - public $title; - - public $action; - - public $type; - public $submitLabel; - public function __construct(string $identifier, string $title, string $action, string $type = 'delete', string $submitLabel = null) - { - $this->identifier = $identifier; - $this->title = $title; - $this->action = $action; - $this->type = $type; + public function __construct( + public string $identifier, + public string $title, + public string $action, + public string $type = 'delete', + string $submitLabel = null + ) { $this->submitLabel = $submitLabel ?: $this->title; }