Refactored BooleanValidator (#13791)

This commit is contained in:
Гордиенко Владислав Юрьевич
2017-03-17 03:59:11 +05:00
committed by Alexander Makarov
parent 1b322f519f
commit cd64fb2dc6

View File

@ -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, [