Skip to content

Commit

Permalink
Refactored BooleanValidator (yiisoft#13791)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladis84 authored and samdark committed Mar 16, 2017
1 parent 1b322f5 commit cd64fb2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions framework/validators/BooleanValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ public function init()
*/
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, [
Expand Down

0 comments on commit cd64fb2

Please sign in to comment.