public function validate() : void
    {
        $this->value = null;
        $value = $this->filter($this->raw_value);
        if (true === $this->checkValidity($value)) {
            $this->is_valid = true;
        } else {
            $this->is_valid = false;
            $this->reportError($this->error_message);
            $error_message = sprintf($this->error_message, $this->field_name);
            $this->the_message = $error_message;
        }
        // If no issues have been found, check the constraints.
        if ($this->is_valid) {
            foreach ($this->constraints as $constraint) {
                if (false === $constraint->check($value)) {
                    $this->is_valid = false;
                    $this->the_message = sprintf($constraint->getErrorMessage(), $this->field_name);
                }
            }
        }
        // Set the value for retrieval
        if ($this->is_valid) {
            $this->value = $value;
        }
    }
public function validate() : void
    {
        $this->value = null;
        $value = $this->filter($this->raw_value);
        if (true === $this->checkValidity($value)) {
            $this->is_valid = true;
        } else {
            $this->is_valid = false;
            $this->reportError($this->error_message);
            $error_message = sprintf($this->error_message, $this->field_name);
            $this->the_message = $error_message;
        }
        // If no issues have been found, check the constraints.
        if ($this->is_valid) {
            foreach ($this->constraints as $constraint) {
                if (false === $constraint->check($value)) {
                    $this->is_valid = false;
                    $this->the_message = sprintf($constraint->getErrorMessage(), $this->field_name);
                }
            }
        }
        // Set the value for retrieval
        if ($this->is_valid) {
            $this->value = $value;
        }
    }
public function validate ( ) : void { $ this -> value = null ; $ value = $ this -> filter ( $ this -> raw_value ) ; if ( true === $ this -> checkValidity ( $ value ) ) { $ this -> is_valid = true ; } else { $ this -> is_valid = false ; $ this -> reportError ( $ this -> error_message ) ; $ error_message = sprintf ( $ this -> error_message , $ this -> field_name ) ; $ this -> the_message = $ error_message ; } // If no issues have been found, check the constraints. if ( $ this -> is_valid ) { foreach ( $ this -> constraints as $ constraint ) { if ( false === $ constraint -> check ( $ value ) ) { $ this -> is_valid = false ; $ this -> the_message = sprintf ( $ constraint -> getErrorMessage ( ) , $ this -> field_name ) ; } } } // Set the value for retrieval if ( $ this -> is_valid ) { $ this -> value = $ value ; } }
Do the validation. This process starts by filtering the value, then checks the validity, and finally checks
the constraints.
Do the validation . This process starts by filtering the value then checks the validity and finally checks the constraints .