Remove the redundant `$icon` property
authorAlexander Ebert <ebert@woltlab.com>
Sun, 12 Mar 2023 22:45:42 +0000 (23:45 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 12 Mar 2023 22:45:42 +0000 (23:45 +0100)
Fixes #5160

wcfsetup/install/files/lib/system/form/builder/field/IconFormField.class.php

index 548ba2f8153547282c80746320a8e8c08fd576a8..9bb8758aa0b36f3b7a0a4f7c9c52b85f1aa04c88 100644 (file)
@@ -17,8 +17,6 @@ class IconFormField extends AbstractFormField implements IImmutableFormField
 {
     use TImmutableFormField;
 
-    private ?FontAwesomeIcon $icon;
-
     /**
      * @inheritDoc
      */
@@ -111,13 +109,10 @@ class IconFormField extends AbstractFormField implements IImmutableFormField
      */
     public function getIcon(): ?FontAwesomeIcon
     {
-        if (!isset($this->icon)) {
-            $this->icon = null;
-            if ($this->value && FontAwesomeIcon::isValidString($this->value)) {
-                $this->icon = FontAwesomeIcon::fromString($this->value);
-            }
+        if ($this->value && FontAwesomeIcon::isValidString($this->value)) {
+            return FontAwesomeIcon::fromString($this->value);
         }
 
-        return $this->icon;
+        return null;
     }
 }