public function validate(UploadedFile $file)
    {
        foreach ($this->constraints as $constraint) {
            if (!$constraint->validate($file)) {
                throw new ConstraintException($constraint, $file);
            }
        }
        return true;
    }
public function validate(UploadedFile $file)
    {
        foreach ($this->constraints as $constraint) {
            if (!$constraint->validate($file)) {
                throw new ConstraintException($constraint, $file);
            }
        }
        return true;
    }
public function validate ( UploadedFile $ file ) { foreach ( $ this -> constraints as $ constraint ) { if ( ! $ constraint -> validate ( $ file ) ) { throw new ConstraintException ( $ constraint , $ file ) ; } } return true ; }
Validate the file

@param UploadedFile $file
@return true
@throws ConstraintException
Validate the file