Skip to content

Commit 794ce3c

Browse files
authored
feat(response): Add merge violations helper method (#1114)
1 parent ca46d1b commit 794ce3c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/GraphQL/Response/Response.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,11 @@ public function getViolations(): array {
4040
return $this->violations;
4141
}
4242

43+
/**
44+
* {@inheritdoc}
45+
*/
46+
public function mergeViolations(ResponseInterface $source): void {
47+
$this->violations = array_merge($this->violations, $source->getViolations());
48+
}
49+
4350
}

src/GraphQL/Response/ResponseInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,9 @@ public function addViolations(array $messages, array $properties = []): void;
3737
*/
3838
public function getViolations(): array;
3939

40+
/**
41+
* Adds the violations from another response to this response.
42+
*/
43+
public function mergeViolations(ResponseInterface $source): void;
44+
4045
}

0 commit comments

Comments
 (0)