示例#1
0
 protected function validateType($type, $data)
 {
     $types = (array) $type;
     $result = false;
     foreach ($types as $type) {
         if (Utils::checkType($type, $data)) {
             $result = true;
             break;
         }
     }
     if (!$result) {
         $this->throwError(sprintf("value must be of type '%s'", implode(', ', $types)));
     }
 }
示例#2
0
 public function testFail()
 {
     $value = array(1, 2, 3);
     $this->assertFalse(Utils::checkType('object', $value));
 }