This commit is contained in:
Your Name
2021-07-26 19:46:18 +02:00
parent e7a49138bb
commit aae17f10a6
818 changed files with 70695 additions and 16408 deletions
@@ -9,6 +9,7 @@ use GraphQL\Language\AST\FragmentDefinitionNode;
use GraphQL\Language\AST\NameNode;
use GraphQL\Language\AST\NodeKind;
use GraphQL\Language\Visitor;
use GraphQL\Language\VisitorOperation;
use GraphQL\Validator\ValidationContext;
use function sprintf;
@@ -22,12 +23,12 @@ class UniqueFragmentNames extends ValidationRule
$this->knownFragmentNames = [];
return [
NodeKind::OPERATION_DEFINITION => static function () {
NodeKind::OPERATION_DEFINITION => static function () : VisitorOperation {
return Visitor::skipNode();
},
NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) use ($context) {
NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) use ($context) : VisitorOperation {
$fragmentName = $node->name->value;
if (empty($this->knownFragmentNames[$fragmentName])) {
if (! isset($this->knownFragmentNames[$fragmentName])) {
$this->knownFragmentNames[$fragmentName] = $node->name;
} else {
$context->reportError(new Error(