@@ -74,7 +74,7 @@ |
||
| 74 | 74 | if (is_array($config)) { |
| 75 | 75 | $config = ServerConfig::create($config); |
| 76 | 76 | } |
| 77 | - if (! $config instanceof ServerConfig) { |
|
| 77 | + if (!$config instanceof ServerConfig) { |
|
| 78 | 78 | throw new InvariantViolation('Expecting valid server config, but got ' . Utils::printSafe($config)); |
| 79 | 79 | } |
| 80 | 80 | $this->config = $config; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $instance = new static(); |
| 44 | 44 | foreach ($config as $key => $value) { |
| 45 | 45 | $method = 'set' . ucfirst($key); |
| 46 | - if (! method_exists($instance, $method)) { |
|
| 46 | + if (!method_exists($instance, $method)) { |
|
| 47 | 47 | throw new InvariantViolation(sprintf('Unknown server config option "%s"', $key)); |
| 48 | 48 | } |
| 49 | 49 | $instance->$method($value); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function setValidationRules($validationRules) |
| 157 | 157 | { |
| 158 | - if (! is_callable($validationRules) && ! is_array($validationRules) && $validationRules !== null) { |
|
| 158 | + if (!is_callable($validationRules) && !is_array($validationRules) && $validationRules !== null) { |
|
| 159 | 159 | throw new InvariantViolation( |
| 160 | 160 | 'Server config expects array of validation rules or callable returning such array, but got ' . |
| 161 | 161 | Utils::printSafe($validationRules) |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | return [ |
| 24 | 24 | NodeKind::OPERATION_DEFINITION => [ |
| 25 | - 'enter' => function () { |
|
| 25 | + 'enter' => function() { |
|
| 26 | 26 | $this->variableDefs = []; |
| 27 | 27 | }, |
| 28 | - 'leave' => function (OperationDefinitionNode $operation) use ($context) { |
|
| 28 | + 'leave' => function(OperationDefinitionNode $operation) use ($context) { |
|
| 29 | 29 | $variableNameUsed = []; |
| 30 | 30 | $usages = $context->getRecursiveVariableUsages($operation); |
| 31 | 31 | $opName = $operation->name ? $operation->name->value : null; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | foreach ($this->variableDefs as $variableDef) { |
| 39 | 39 | $variableName = $variableDef->variable->name->value; |
| 40 | 40 | |
| 41 | - if (! empty($variableNameUsed[$variableName])) { |
|
| 41 | + if (!empty($variableNameUsed[$variableName])) { |
|
| 42 | 42 | continue; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | }, |
| 51 | 51 | ], |
| 52 | - NodeKind::VARIABLE_DEFINITION => function ($def) { |
|
| 52 | + NodeKind::VARIABLE_DEFINITION => function($def) { |
|
| 53 | 53 | $this->variableDefs[] = $def; |
| 54 | 54 | }, |
| 55 | 55 | ]; |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | public function getVisitor(ValidationContext $context) |
| 24 | 24 | { |
| 25 | 25 | return [ |
| 26 | - NodeKind::INLINE_FRAGMENT => function (InlineFragmentNode $node) use ($context) { |
|
| 26 | + NodeKind::INLINE_FRAGMENT => function(InlineFragmentNode $node) use ($context) { |
|
| 27 | 27 | $fragType = $context->getType(); |
| 28 | 28 | $parentType = $context->getParentType(); |
| 29 | 29 | |
| 30 | - if (! ($fragType instanceof CompositeType) || |
|
| 31 | - ! ($parentType instanceof CompositeType) || |
|
| 30 | + if (!($fragType instanceof CompositeType) || |
|
| 31 | + !($parentType instanceof CompositeType) || |
|
| 32 | 32 | $this->doTypesOverlap($context->getSchema(), $fragType, $parentType)) { |
| 33 | 33 | return; |
| 34 | 34 | } |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | [$node] |
| 39 | 39 | )); |
| 40 | 40 | }, |
| 41 | - NodeKind::FRAGMENT_SPREAD => function (FragmentSpreadNode $node) use ($context) { |
|
| 41 | + NodeKind::FRAGMENT_SPREAD => function(FragmentSpreadNode $node) use ($context) { |
|
| 42 | 42 | $fragName = $node->name->value; |
| 43 | 43 | $fragType = $this->getFragmentType($context, $fragName); |
| 44 | 44 | $parentType = $context->getParentType(); |
| 45 | 45 | |
| 46 | - if (! $fragType || |
|
| 47 | - ! $parentType || |
|
| 46 | + if (!$fragType || |
|
| 47 | + !$parentType || |
|
| 48 | 48 | $this->doTypesOverlap($context->getSchema(), $fragType, $parentType) |
| 49 | 49 | ) { |
| 50 | 50 | return; |
@@ -21,10 +21,10 @@ |
||
| 21 | 21 | $this->knownVariableNames = []; |
| 22 | 22 | |
| 23 | 23 | return [ |
| 24 | - NodeKind::OPERATION_DEFINITION => function () { |
|
| 24 | + NodeKind::OPERATION_DEFINITION => function() { |
|
| 25 | 25 | $this->knownVariableNames = []; |
| 26 | 26 | }, |
| 27 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $node) use ($context) { |
|
| 27 | + NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $node) use ($context) { |
|
| 28 | 28 | $variableName = $node->variable->name->value; |
| 29 | 29 | if (empty($this->knownVariableNames[$variableName])) { |
| 30 | 30 | $this->knownVariableNames[$variableName] = $node->variable->name; |
@@ -27,18 +27,18 @@ |
||
| 27 | 27 | |
| 28 | 28 | return [ |
| 29 | 29 | NodeKind::OBJECT => [ |
| 30 | - 'enter' => function () { |
|
| 30 | + 'enter' => function() { |
|
| 31 | 31 | $this->knownNameStack[] = $this->knownNames; |
| 32 | 32 | $this->knownNames = []; |
| 33 | 33 | }, |
| 34 | - 'leave' => function () { |
|
| 34 | + 'leave' => function() { |
|
| 35 | 35 | $this->knownNames = array_pop($this->knownNameStack); |
| 36 | 36 | }, |
| 37 | 37 | ], |
| 38 | - NodeKind::OBJECT_FIELD => function (ObjectFieldNode $node) use ($context) { |
|
| 38 | + NodeKind::OBJECT_FIELD => function(ObjectFieldNode $node) use ($context) { |
|
| 39 | 39 | $fieldName = $node->name->value; |
| 40 | 40 | |
| 41 | - if (! empty($this->knownNames[$fieldName])) { |
|
| 41 | + if (!empty($this->knownNames[$fieldName])) { |
|
| 42 | 42 | $context->reportError(new Error( |
| 43 | 43 | self::duplicateInputFieldMessage($fieldName), |
| 44 | 44 | [$this->knownNames[$fieldName], $node->name] |
@@ -22,15 +22,15 @@ |
||
| 22 | 22 | $this->knownArgNames = []; |
| 23 | 23 | |
| 24 | 24 | return [ |
| 25 | - NodeKind::FIELD => function () { |
|
| 25 | + NodeKind::FIELD => function() { |
|
| 26 | 26 | $this->knownArgNames = []; |
| 27 | 27 | }, |
| 28 | - NodeKind::DIRECTIVE => function () { |
|
| 28 | + NodeKind::DIRECTIVE => function() { |
|
| 29 | 29 | $this->knownArgNames = []; |
| 30 | 30 | }, |
| 31 | - NodeKind::ARGUMENT => function (ArgumentNode $node) use ($context) { |
|
| 31 | + NodeKind::ARGUMENT => function(ArgumentNode $node) use ($context) { |
|
| 32 | 32 | $argName = $node->name->value; |
| 33 | - if (! empty($this->knownArgNames[$argName])) { |
|
| 33 | + if (!empty($this->knownArgNames[$argName])) { |
|
| 34 | 34 | $context->reportError(new Error( |
| 35 | 35 | self::duplicateArgMessage($argName), |
| 36 | 36 | [$this->knownArgNames[$argName], $node->name] |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | public function getVisitor(ValidationContext $context) |
| 24 | 24 | { |
| 25 | 25 | return [ |
| 26 | - NodeKind::FIELD => function (FieldNode $node) use ($context) { |
|
| 26 | + NodeKind::FIELD => function(FieldNode $node) use ($context) { |
|
| 27 | 27 | $type = $context->getParentType(); |
| 28 | - if (! $type) { |
|
| 28 | + if (!$type) { |
|
| 29 | 29 | return; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -84,19 +84,19 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | foreach ($schema->getPossibleTypes($type) as $possibleType) { |
| 86 | 86 | $fields = $possibleType->getFields(); |
| 87 | - if (! isset($fields[$fieldName])) { |
|
| 87 | + if (!isset($fields[$fieldName])) { |
|
| 88 | 88 | continue; |
| 89 | 89 | } |
| 90 | 90 | // This object type defines this field. |
| 91 | 91 | $suggestedObjectTypes[] = $possibleType->name; |
| 92 | 92 | foreach ($possibleType->getInterfaces() as $possibleInterface) { |
| 93 | 93 | $fields = $possibleInterface->getFields(); |
| 94 | - if (! isset($fields[$fieldName])) { |
|
| 94 | + if (!isset($fields[$fieldName])) { |
|
| 95 | 95 | continue; |
| 96 | 96 | } |
| 97 | 97 | // This interface type defines this field. |
| 98 | 98 | $interfaceUsageCount[$possibleInterface->name] = |
| 99 | - ! isset($interfaceUsageCount[$possibleInterface->name]) |
|
| 99 | + !isset($interfaceUsageCount[$possibleInterface->name]) |
|
| 100 | 100 | ? 0 |
| 101 | 101 | : $interfaceUsageCount[$possibleInterface->name] + 1; |
| 102 | 102 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $suggestions = Utils::quotedOrList($suggestedTypeNames); |
| 154 | 154 | |
| 155 | 155 | $message .= sprintf(' Did you mean to use an inline fragment on %s?', $suggestions); |
| 156 | - } elseif (! empty($suggestedFieldNames)) { |
|
| 156 | + } elseif (!empty($suggestedFieldNames)) { |
|
| 157 | 157 | $suggestions = Utils::quotedOrList($suggestedFieldNames); |
| 158 | 158 | |
| 159 | 159 | $message .= sprintf(' Did you mean %s?', $suggestions); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | $context, |
| 29 | 29 | [ |
| 30 | 30 | NodeKind::OPERATION_DEFINITION => [ |
| 31 | - 'leave' => function (OperationDefinitionNode $operationDefinition) use ($context) { |
|
| 31 | + 'leave' => function(OperationDefinitionNode $operationDefinition) use ($context) { |
|
| 32 | 32 | $maxDepth = $this->fieldDepth($operationDefinition); |
| 33 | 33 | |
| 34 | 34 | if ($maxDepth <= $this->getMaxQueryDepth()) { |