/**
  * @param ArrayValue\MaximumItemsConstraint $constraint
  *
  * @return string
  */
 public function visitMaximumItemsConstraint(ArrayValue\MaximumItemsConstraint $constraint)
 {
     return sprintf('The array must not have more than %s items.', var_export($constraint->maximum(), true));
 }
Exemplo n.º 2
0
 /**
  * @param ArrayValue\MaximumItemsConstraint $constraint
  *
  * @return Result\ValidationResult
  */
 public function visitMaximumItemsConstraint(ArrayValue\MaximumItemsConstraint $constraint)
 {
     $value = $this->currentValue();
     if (!$value instanceof Value\ArrayValue || $value->count() <= $constraint->maximum()) {
         return $this->createResult();
     }
     return $this->createSingleIssueResult($constraint);
 }