@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | foreach ($definedDirectives as $directive) { |
| 44 | 44 | $requiredArgsMap[$directive->name] = Utils::keyMap( |
| 45 | - array_filter($directive->args, static function (FieldArgument $arg) : bool { |
|
| 46 | - return $arg->getType() instanceof NonNull && ! isset($arg->defaultValue); |
|
| 45 | + array_filter($directive->args, static function(FieldArgument $arg) : bool { |
|
| 46 | + return $arg->getType() instanceof NonNull && !isset($arg->defaultValue); |
|
| 47 | 47 | }), |
| 48 | - static function (FieldArgument $arg) : string { |
|
| 48 | + static function(FieldArgument $arg) : string { |
|
| 49 | 49 | return $arg->name; |
| 50 | 50 | } |
| 51 | 51 | ); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $astDefinition = $context->getDocument()->definitions; |
| 55 | 55 | foreach ($astDefinition as $def) { |
| 56 | - if (! ($def instanceof DirectiveDefinitionNode)) { |
|
| 56 | + if (!($def instanceof DirectiveDefinitionNode)) { |
|
| 57 | 57 | continue; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -66,31 +66,31 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $requiredArgsMap[$def->name->value] = Utils::keyMap( |
| 69 | - $arguments ? array_filter($arguments, static function (Node $argument) : bool { |
|
| 69 | + $arguments ? array_filter($arguments, static function(Node $argument) : bool { |
|
| 70 | 70 | return $argument instanceof NonNullTypeNode && |
| 71 | 71 | ( |
| 72 | - ! isset($argument->defaultValue) || |
|
| 72 | + !isset($argument->defaultValue) || |
|
| 73 | 73 | $argument->defaultValue === null |
| 74 | 74 | ); |
| 75 | 75 | }) : [], |
| 76 | - static function (NamedTypeNode $argument) : string { |
|
| 76 | + static function(NamedTypeNode $argument) : string { |
|
| 77 | 77 | return $argument->name->value; |
| 78 | 78 | } |
| 79 | 79 | ); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | return [ |
| 83 | - NodeKind::DIRECTIVE => static function (DirectiveNode $directiveNode) use ($requiredArgsMap, $context) { |
|
| 83 | + NodeKind::DIRECTIVE => static function(DirectiveNode $directiveNode) use ($requiredArgsMap, $context) { |
|
| 84 | 84 | $directiveName = $directiveNode->name->value; |
| 85 | 85 | $requiredArgs = $requiredArgsMap[$directiveName] ?? null; |
| 86 | - if (! $requiredArgs) { |
|
| 86 | + if (!$requiredArgs) { |
|
| 87 | 87 | return; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $argNodes = $directiveNode->arguments ?: []; |
| 91 | 91 | $argNodeMap = Utils::keyMap( |
| 92 | 92 | $argNodes, |
| 93 | - static function (ArgumentNode $arg) : string { |
|
| 93 | + static function(ArgumentNode $arg) : string { |
|
| 94 | 94 | return $arg->name->value; |
| 95 | 95 | } |
| 96 | 96 | ); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | foreach ($definedDirectives as $directive) { |
| 40 | 40 | $directiveArgs[$directive->name] = array_map( |
| 41 | - static function (FieldArgument $arg) : string { |
|
| 41 | + static function(FieldArgument $arg) : string { |
|
| 42 | 42 | return $arg->name; |
| 43 | 43 | }, |
| 44 | 44 | $directive->args |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $astDefinitions = $context->getDocument()->definitions; |
| 49 | 49 | foreach ($astDefinitions as $def) { |
| 50 | - if (! ($def instanceof DirectiveDefinitionNode)) { |
|
| 50 | + if (!($def instanceof DirectiveDefinitionNode)) { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $arguments = iterator_to_array($arguments->getIterator()); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - $directiveArgs[$name] = array_map(static function (InputValueDefinitionNode $arg) : string { |
|
| 62 | + $directiveArgs[$name] = array_map(static function(InputValueDefinitionNode $arg) : string { |
|
| 63 | 63 | return $arg->name->value; |
| 64 | 64 | }, $arguments); |
| 65 | 65 | } else { |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | return [ |
| 71 | - NodeKind::DIRECTIVE => static function (DirectiveNode $directiveNode) use ($directiveArgs, $context) { |
|
| 71 | + NodeKind::DIRECTIVE => static function(DirectiveNode $directiveNode) use ($directiveArgs, $context) { |
|
| 72 | 72 | $directiveName = $directiveNode->name->value; |
| 73 | 73 | $knownArgs = $directiveArgs[$directiveName] ?? null; |
| 74 | 74 | |
| 75 | - if ($directiveNode->arguments === null || ! $knownArgs) { |
|
| 75 | + if ($directiveNode->arguments === null || !$knownArgs) { |
|
| 76 | 76 | return; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | public function getVisitor(ValidationContext $context) |
| 26 | 26 | { |
| 27 | 27 | return [ |
| 28 | - NodeKind::DOCUMENT => static function (DocumentNode $node) use ($context) { |
|
| 28 | + NodeKind::DOCUMENT => static function(DocumentNode $node) use ($context) { |
|
| 29 | 29 | /** @var Node $definition */ |
| 30 | 30 | foreach ($node->definitions as $definition) { |
| 31 | 31 | if ($definition instanceof OperationDefinitionNode || |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function getVisitor(ValidationContext $context) |
| 26 | 26 | { |
| 27 | 27 | return [ |
| 28 | - NodeKind::VARIABLE_DEFINITION => static function (VariableDefinitionNode $node) use ($context) { |
|
| 28 | + NodeKind::VARIABLE_DEFINITION => static function(VariableDefinitionNode $node) use ($context) { |
|
| 29 | 29 | $name = $node->variable->name->value; |
| 30 | 30 | $defaultValue = $node->defaultValue; |
| 31 | 31 | $type = $context->getInputType(); |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | return Visitor::skipNode(); |
| 46 | 46 | }, |
| 47 | - NodeKind::SELECTION_SET => static function (SelectionSetNode $node) { |
|
| 47 | + NodeKind::SELECTION_SET => static function(SelectionSetNode $node) { |
|
| 48 | 48 | return Visitor::skipNode(); |
| 49 | 49 | }, |
| 50 | - NodeKind::FRAGMENT_DEFINITION => static function (FragmentDefinitionNode $node) { |
|
| 50 | + NodeKind::FRAGMENT_DEFINITION => static function(FragmentDefinitionNode $node) { |
|
| 51 | 51 | return Visitor::skipNode(); |
| 52 | 52 | }, |
| 53 | 53 | ]; |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $schemaDefinitionsCount = 0; |
| 30 | 30 | |
| 31 | 31 | return [ |
| 32 | - NodeKind::SCHEMA_DEFINITION => static function (SchemaDefinitionNode $node) use ($alreadyDefined, $context, &$schemaDefinitionsCount) { |
|
| 32 | + NodeKind::SCHEMA_DEFINITION => static function(SchemaDefinitionNode $node) use ($alreadyDefined, $context, &$schemaDefinitionsCount) { |
|
| 33 | 33 | if ($alreadyDefined !== false) { |
| 34 | 34 | $context->reportError(new Error('Cannot define a new schema within a schema extension.', $node)); |
| 35 | 35 | return; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | public function getVisitor(ValidationContext $context) |
| 16 | 16 | { |
| 17 | 17 | return [ |
| 18 | - NodeKind::FRAGMENT_SPREAD => static function (FragmentSpreadNode $node) use ($context) { |
|
| 18 | + NodeKind::FRAGMENT_SPREAD => static function(FragmentSpreadNode $node) use ($context) { |
|
| 19 | 19 | $fragmentName = $node->name->value; |
| 20 | 20 | $fragment = $context->getFragment($fragmentName); |
| 21 | 21 | if ($fragment) { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | return $this->invokeIfNeeded( |
| 58 | 58 | $context, |
| 59 | 59 | [ |
| 60 | - NodeKind::SELECTION_SET => function (SelectionSetNode $selectionSet) use ($context) { |
|
| 60 | + NodeKind::SELECTION_SET => function(SelectionSetNode $selectionSet) use ($context) { |
|
| 61 | 61 | $this->fieldNodeAndDefs = $this->collectFieldASTsAndDefs( |
| 62 | 62 | $context, |
| 63 | 63 | $context->getParentType(), |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | $this->fieldNodeAndDefs |
| 67 | 67 | ); |
| 68 | 68 | }, |
| 69 | - NodeKind::VARIABLE_DEFINITION => function ($def) { |
|
| 69 | + NodeKind::VARIABLE_DEFINITION => function($def) { |
|
| 70 | 70 | $this->variableDefs[] = $def; |
| 71 | 71 | |
| 72 | 72 | return Visitor::skipNode(); |
| 73 | 73 | }, |
| 74 | 74 | NodeKind::OPERATION_DEFINITION => [ |
| 75 | - 'leave' => function (OperationDefinitionNode $operationDefinition) use ($context, &$complexity) { |
|
| 75 | + 'leave' => function(OperationDefinitionNode $operationDefinition) use ($context, &$complexity) { |
|
| 76 | 76 | $errors = $context->getErrors(); |
| 77 | 77 | |
| 78 | - if (! empty($errors)) { |
|
| 78 | + if (!empty($errors)) { |
|
| 79 | 79 | return; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -191,11 +191,11 @@ discard block |
||
| 191 | 191 | $this->variableDefs, |
| 192 | 192 | $this->getRawVariableValues() |
| 193 | 193 | ); |
| 194 | - if (! empty($errors)) { |
|
| 194 | + if (!empty($errors)) { |
|
| 195 | 195 | throw new Error(implode( |
| 196 | 196 | "\n\n", |
| 197 | 197 | array_map( |
| 198 | - static function ($error) { |
|
| 198 | + static function($error) { |
|
| 199 | 199 | return $error->getMessage(); |
| 200 | 200 | }, |
| 201 | 201 | $errors |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $directive = Directive::includeDirective(); |
| 207 | 207 | /** @var bool $directiveArgsIf */ |
| 208 | 208 | $directiveArgsIf = Values::getArgumentValues($directive, $directiveNode, $variableValues)['if']; |
| 209 | - return ! $directiveArgsIf; |
|
| 209 | + return !$directiveArgsIf; |
|
| 210 | 210 | } |
| 211 | 211 | $directive = Directive::skipDirective(); |
| 212 | 212 | $directiveArgsIf = Values::getArgumentValues($directive, $directiveNode, $variableValues); |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | $rawVariableValues |
| 243 | 243 | ); |
| 244 | 244 | |
| 245 | - if (! empty($errors)) { |
|
| 245 | + if (!empty($errors)) { |
|
| 246 | 246 | throw new Error(implode( |
| 247 | 247 | "\n\n", |
| 248 | 248 | array_map( |
| 249 | - static function ($error) { |
|
| 249 | + static function($error) { |
|
| 250 | 250 | return $error->getMessage(); |
| 251 | 251 | }, |
| 252 | 252 | $errors |
@@ -26,17 +26,17 @@ |
||
| 26 | 26 | $operationCount = 0; |
| 27 | 27 | |
| 28 | 28 | return [ |
| 29 | - NodeKind::DOCUMENT => static function (DocumentNode $node) use (&$operationCount) { |
|
| 29 | + NodeKind::DOCUMENT => static function(DocumentNode $node) use (&$operationCount) { |
|
| 30 | 30 | $tmp = Utils::filter( |
| 31 | 31 | $node->definitions, |
| 32 | - static function (Node $definition) { |
|
| 32 | + static function(Node $definition) { |
|
| 33 | 33 | return $definition->kind === NodeKind::OPERATION_DEFINITION; |
| 34 | 34 | } |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | $operationCount = count($tmp); |
| 38 | 38 | }, |
| 39 | - NodeKind::OPERATION_DEFINITION => static function (OperationDefinitionNode $node) use ( |
|
| 39 | + NodeKind::OPERATION_DEFINITION => static function(OperationDefinitionNode $node) use ( |
|
| 40 | 40 | &$operationCount, |
| 41 | 41 | $context |
| 42 | 42 | ) { |
@@ -22,10 +22,10 @@ |
||
| 22 | 22 | $this->knownFragmentNames = []; |
| 23 | 23 | |
| 24 | 24 | return [ |
| 25 | - NodeKind::OPERATION_DEFINITION => static function () { |
|
| 25 | + NodeKind::OPERATION_DEFINITION => static function() { |
|
| 26 | 26 | return Visitor::skipNode(); |
| 27 | 27 | }, |
| 28 | - NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) use ($context) { |
|
| 28 | + NodeKind::FRAGMENT_DEFINITION => function(FragmentDefinitionNode $node) use ($context) { |
|
| 29 | 29 | $fragmentName = $node->name->value; |
| 30 | 30 | if (empty($this->knownFragmentNames[$fragmentName])) { |
| 31 | 31 | $this->knownFragmentNames[$fragmentName] = $node->name; |