mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-04 14:46:19 +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)
 | 
					    protected function validateValue($value)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $valid = !$this->strict && ($value == $this->trueValue || $value == $this->falseValue)
 | 
					        if ($this->strict) {
 | 
				
			||||||
                 || $this->strict && ($value === $this->trueValue || $value === $this->falseValue);
 | 
					            $valid = $value === $this->trueValue || $value === $this->falseValue;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $valid = $value == $this->trueValue || $value == $this->falseValue;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!$valid) {
 | 
					        if (!$valid) {
 | 
				
			||||||
            return [$this->message, [
 | 
					            return [$this->message, [
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user