public function __invoke(ValidationContext $context)
{
$this->comparedSet = new PairSet();
return [NodeKind::SELECTION_SET => ['leave' => function (SelectionSetNode $selectionSet) use($context) {
$fieldMap = $this->collectFieldNodesAndDefs($context, $context->getParentType(), $selectionSet);
$conflicts = $this->findConflicts(false, $fieldMap, $context);
foreach ($conflicts as $conflict) {
$responseName = $conflict[0][0];
$reason = $conflict[0][1];
$fields1 = $conflict[1];
$fields2 = $conflict[2];
$context->reportError(new Error(self::fieldsConflictMessage($responseName, $reason), array_merge($fields1, $fields2)));
}
}]];
}