Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function apply($instance, stdClass $schema, Context $context, Walker $walker)
 {
     $altContext = $context->duplicate();
     $walker->applyConstraints($instance, $schema->not, $altContext);
     if ($altContext->countViolations() === $context->countViolations()) {
         $context->addViolation('should not match schema in "not"');
     }
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function apply($instance, stdClass $schema, Context $context, Walker $walker)
 {
     $originalCount = $context->countViolations();
     foreach ($schema->allOf as $subSchema) {
         $walker->applyConstraints($instance, $subSchema, $context);
     }
     if ($context->countViolations() > $originalCount) {
         $context->addViolation('instance must match all the schemas listed in allOf');
     }
 }