Simplify the events by using constructor property promotion
authorAlexander Ebert <ebert@woltlab.com>
Fri, 11 Nov 2022 17:33:38 +0000 (18:33 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 13 Nov 2022 14:28:21 +0000 (15:28 +0100)
wcfsetup/install/files/lib/system/language/event/LanguageImported.class.php
wcfsetup/install/files/lib/system/language/event/PhraseChanged.class.php

index e88353221a5d242ab3633efc42e020c43c06aef6..7ce1f823885da8d9222675a04866988f0de3a481 100644 (file)
@@ -17,10 +17,8 @@ use wcf\system\event\IEvent;
  */
 final class LanguageImported implements IEvent
 {
-    public readonly Language $language;
-
-    public function __construct(Language $language)
-    {
-        $this->language = $language;
+    public function __construct(
+        public readonly Language $language
+    ) {
     }
 }
index 50b1c89f5c6cadb30557471c3ef81e8461ac0a65..772bfe9a71f60d4f26167f02ef7bbb17663d95d8 100644 (file)
@@ -16,12 +16,9 @@ use wcf\system\event\IEvent;
  */
 final class PhraseChanged implements IEvent
 {
-    public readonly Language $language;
-    public readonly string $name;
-
-    public function __construct(Language $language, string $name)
-    {
-        $this->language = $language;
-        $this->name = $name;
+    public function __construct(
+        public readonly Language $language,
+        public readonly string $name
+    ) {
     }
 }