From 6ac02fd18d42a68163aa3f0bae088df405f1800c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 4 May 2023 10:28:12 +0200 Subject: [PATCH] Improve formatting in SelectFormField::validate() --- .../form/builder/field/SelectFormField.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/system/form/builder/field/SelectFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/SelectFormField.class.php index 6d997a37c4..26015d2b3f 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/SelectFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/SelectFormField.class.php @@ -55,11 +55,13 @@ final class SelectFormField extends AbstractFormField implements if ($this->isRequired()) { $this->addValidationError(new FormFieldValidationError('empty')); } - } else if (!isset($this->getOptions()[$this->getValue()])) { - $this->addValidationError(new FormFieldValidationError( - 'invalidValue', - 'wcf.global.form.error.noValidSelection' - )); + } else { + if (!isset($this->getOptions()[$this->getValue()])) { + $this->addValidationError(new FormFieldValidationError( + 'invalidValue', + 'wcf.global.form.error.noValidSelection' + )); + } } parent::validate(); -- 2.20.1