Move the icon property initialization into the constructor
authorAlexander Ebert <ebert@woltlab.com>
Wed, 20 Sep 2023 13:17:51 +0000 (15:17 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 20 Sep 2023 13:17:51 +0000 (15:17 +0200)
wcfsetup/install/files/lib/data/user/menu/item/UserMenuItem.class.php
wcfsetup/install/files/lib/data/user/menu/item/event/UserMenuItemIconResolving.class.php

index 0ecb521f4f4764f8c851a90502259fc6cbea55e7..5c28ec583905fbc700d88e6145c88c35da177a15 100644 (file)
@@ -161,8 +161,7 @@ class UserMenuItem extends ProcessibleDatabaseObject implements ITitledObject, I
             $icon = FontAwesomeIcon::fromValues('bars');
         }
 
-        $event = new UserMenuItemIconResolving($this);
-        $event->icon = $icon;
+        $event = new UserMenuItemIconResolving($this, $icon);
         EventHandler::getInstance()->fire($event);
 
         return $event->icon;
index 5a811460db72ac143b1b0b0e1ec81f5d3e6d8051..4351fb928b5de441ed1bdf21e5ae6de513ef91d2 100644 (file)
@@ -16,9 +16,9 @@ use wcf\system\style\IFontAwesomeIcon;
  */
 final class UserMenuItemIconResolving implements IEvent
 {
-    public IFontAwesomeIcon $icon;
-
-    public function __construct(public readonly UserMenuItem $userMenuItem)
-    {
+    public function __construct(
+        public readonly UserMenuItem $userMenuItem,
+        public IFontAwesomeIcon $icon
+    {
     }
 }