Ejemplo n.º 1
0
 protected function assertValid(array $values)
 {
     if (empty($values)) {
         return;
     }
     if ($values !== array_values($values)) {
         throw ValidationException::invalid('Set structures cannot have distinct keys');
     }
 }
Ejemplo n.º 2
0
 protected function assertValid(array $values)
 {
     if (empty($values)) {
         return;
     }
     $keys = array_keys($values);
     $vals = array_values($values);
     if ($keys === array_keys($vals)) {
         throw ValidationException::invalid('Dictionary values must have distinct keys');
     }
 }