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