From: Tim Düsterhus Date: Wed, 25 Aug 2021 11:25:31 +0000 (+0200) Subject: Make requirement validation more readable in UserFormField::validate() X-Git-Tag: 5.4.5_RC_1~16 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=143b3c769fd341710ad2a3e4c19945bb5ec997f5;p=GitHub%2FWoltLab%2FWCF.git Make requirement validation more readable in UserFormField::validate() --- diff --git a/wcfsetup/install/files/lib/system/form/builder/field/user/UserFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/user/UserFormField.class.php index 4b365da45f..6a6be22c9f 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/user/UserFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/user/UserFormField.class.php @@ -137,13 +137,14 @@ class UserFormField extends AbstractFormField implements */ public function validate() { - if ( - $this->isRequired() && ( - ($this->getValue() === null || $this->getValue() === '') + if ($this->isRequired()) { + if ( + $this->getValue() === null + || $this->getValue() === '' || (\is_array($this->getValue()) && empty($this->getValue())) - ) - ) { - $this->addValidationError(new FormFieldValidationError('empty')); + ) { + $this->addValidationError(new FormFieldValidationError('empty')); + } } if ($this->allowsMultiple()) {