@@ 32-43 (lines=12) @@ | ||
29 | /** |
|
30 | * {@inheritdoc} |
|
31 | */ |
|
32 | public function apply($instance, stdClass $schema, Context $context, Walker $walker) |
|
33 | { |
|
34 | $originalCount = $context->countViolations(); |
|
35 | ||
36 | foreach ($schema->allOf as $subSchema) { |
|
37 | $walker->applyConstraints($instance, $subSchema, $context); |
|
38 | } |
|
39 | ||
40 | if ($context->countViolations() > $originalCount) { |
|
41 | $context->addViolation('instance must match all the schemas listed in allOf'); |
|
42 | } |
|
43 | } |
|
44 | } |
|
45 |
@@ 58-66 (lines=9) @@ | ||
55 | /** |
|
56 | * {@inheritdoc} |
|
57 | */ |
|
58 | public function apply($instance, stdClass $schema, Context $context, Walker $walker) |
|
59 | { |
|
60 | $altContext = $context->duplicate(); |
|
61 | $walker->applyConstraints($instance, $schema->not, $altContext); |
|
62 | ||
63 | if ($altContext->countViolations() === $context->countViolations()) { |
|
64 | $context->addViolation('should not match schema in "not"'); |
|
65 | } |
|
66 | } |
|
67 | } |
|
68 |