[web-php] master: Enhancement: Use constructor property promotion (#858)
| From: | Andreas Möller via GitHub | Date: | Wed, 06 Dec 2023 14:08:16 +0000 |
| Subject: | [web-php] master: Enhancement: Use constructor property promotion (#858) | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-31175@lists.php.net to get a copy of this message | ||
Author: Andreas Möller (localheinz)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2023-12-06T14:54:37+01:00
Commit: https://github.com/php/web-php/commit/878429e644b02acf4b63327d0c63259cb47f7c8a
Raw diff: https://github.com/php/web-php/commit/878429e644b02acf4b63327d0c63259cb47f7c8a.diff
Enhancement: Use constructor property promotion (#858)
Changed paths:
M src/UserNotes/UserNote.php
Diff:
diff --git a/src/UserNotes/UserNote.php b/src/UserNotes/UserNote.php
index 54987e0d0f..f90fac9b09 100644
--- a/src/UserNotes/UserNote.php
+++ b/src/UserNotes/UserNote.php
@@ -8,47 +8,15 @@
*/
final class UserNote
{
- /** @var string $id */
- public $id;
-
- /** @var string $sect */
- public $sect;
-
- /** @var string $rate */
- public $rate;
-
- /** @var string $ts */
- public $ts;
-
- /** @var string $user */
- public $user;
-
- /** @var string $text */
- public $text;
-
- /** @var int $upvotes */
- public $upvotes;
-
- /** @var int $downvotes */
- public $downvotes;
-
public function __construct(
- string $id,
- string $sect,
- string $rate,
- string $ts,
- string $user,
- string $text,
- int $upvotes = 0,
- int $downvotes = 0
+ public string $id,
+ public string $sect,
+ public string $rate,
+ public string $ts,
+ public string $user,
+ public string $text,
+ public int $upvotes = 0,
+ public int $downvotes = 0
) {
- $this->id = $id;
- $this->sect = $sect;
- $this->rate = $rate;
- $this->ts = $ts;
- $this->user = $user;
- $this->text = $text;
- $this->upvotes = $upvotes;
- $this->downvotes = $downvotes;
}
}