mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 13:58:55 +08:00
Refactored BooleanValidator (#13791)
This commit is contained in:
committed by
Alexander Makarov
parent
1b322f519f
commit
cd64fb2dc6
@ -52,8 +52,11 @@ class BooleanValidator extends Validator
|
||||
*/
|
||||
protected function validateValue($value)
|
||||
{
|
||||
$valid = !$this->strict && ($value == $this->trueValue || $value == $this->falseValue)
|
||||
|| $this->strict && ($value === $this->trueValue || $value === $this->falseValue);
|
||||
if ($this->strict) {
|
||||
$valid = $value === $this->trueValue || $value === $this->falseValue;
|
||||
} else {
|
||||
$valid = $value == $this->trueValue || $value == $this->falseValue;
|
||||
}
|
||||
|
||||
if (!$valid) {
|
||||
return [$this->message, [
|
||||
|
||||
Reference in New Issue
Block a user