@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | static function duplicateInputFieldMessage($fieldName) |
| 13 | 13 | { |
| 14 | - return "There can be only one input field named \"$fieldName\"."; |
|
| 14 | + return "There can be only one input field named \"$fieldName\"."; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public $knownNames; |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | if (!empty($this->knownNames[$fieldName])) { |
| 39 | 39 | $context->reportError(new Error( |
| 40 | 40 | self::duplicateInputFieldMessage($fieldName), |
| 41 | - [ $this->knownNames[$fieldName], $node->name ] |
|
| 41 | + [$this->knownNames[$fieldName], $node->name] |
|
| 42 | 42 | )); |
| 43 | 43 | } else { |
| 44 | 44 | $this->knownNames[$fieldName] = $node->name; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | return $this->invokeIfNeeded( |
| 79 | 79 | $context, |
| 80 | 80 | [ |
| 81 | - NodeKind::SELECTION_SET => function (SelectionSetNode $selectionSet) use ($context) { |
|
| 81 | + NodeKind::SELECTION_SET => function(SelectionSetNode $selectionSet) use ($context) { |
|
| 82 | 82 | $this->fieldNodeAndDefs = $this->collectFieldASTsAndDefs( |
| 83 | 83 | $context, |
| 84 | 84 | $context->getParentType(), |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | $this->fieldNodeAndDefs |
| 88 | 88 | ); |
| 89 | 89 | }, |
| 90 | - NodeKind::VARIABLE_DEFINITION => function ($def) { |
|
| 90 | + NodeKind::VARIABLE_DEFINITION => function($def) { |
|
| 91 | 91 | $this->variableDefs[] = $def; |
| 92 | 92 | return Visitor::skipNode(); |
| 93 | 93 | }, |
| 94 | 94 | NodeKind::OPERATION_DEFINITION => [ |
| 95 | - 'leave' => function (OperationDefinitionNode $operationDefinition) use ($context, &$complexity) { |
|
| 95 | + 'leave' => function(OperationDefinitionNode $operationDefinition) use ($context, &$complexity) { |
|
| 96 | 96 | $errors = $context->getErrors(); |
| 97 | 97 | |
| 98 | 98 | if (empty($errors)) { |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | if ($variableValuesResult['errors']) { |
| 212 | 212 | throw new Error(implode("\n\n", array_map( |
| 213 | - function ($error) { |
|
| 213 | + function($error) { |
|
| 214 | 214 | return $error->getMessage(); |
| 215 | 215 | } |
| 216 | 216 | , $variableValuesResult['errors']))); |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | if ($variableValuesResult['errors']) { |
| 239 | 239 | throw new Error(implode("\n\n", array_map( |
| 240 | - function ($error) { |
|
| 240 | + function($error) { |
|
| 241 | 241 | return $error->getMessage(); |
| 242 | 242 | } |
| 243 | 243 | , $variableValuesResult['errors']))); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | NodeKind::DOCUMENT => function(DocumentNode $node) use (&$operationCount) { |
| 29 | 29 | $tmp = Utils::filter( |
| 30 | 30 | $node->definitions, |
| 31 | - function ($definition) { |
|
| 31 | + function($definition) { |
|
| 32 | 32 | return $definition->kind === NodeKind::OPERATION_DEFINITION; |
| 33 | 33 | } |
| 34 | 34 | ); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | static function badVarPosMessage($varName, $varType, $expectedType) |
| 17 | 17 | { |
| 18 | - return "Variable \"\$$varName\" of type \"$varType\" used in position expecting ". |
|
| 18 | + return "Variable \"\$$varName\" of type \"$varType\" used in position expecting " . |
|
| 19 | 19 | "type \"$expectedType\"."; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | return [ |
| 27 | 27 | NodeKind::OPERATION_DEFINITION => [ |
| 28 | - 'enter' => function () { |
|
| 28 | + 'enter' => function() { |
|
| 29 | 29 | $this->varDefMap = []; |
| 30 | 30 | }, |
| 31 | 31 | 'leave' => function(OperationDefinitionNode $operation) use ($context) { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | ], |
| 59 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $varDefNode) { |
|
| 59 | + NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $varDefNode) { |
|
| 60 | 60 | $this->varDefMap[$varDefNode->variable->name->value] = $varDefNode; |
| 61 | 61 | } |
| 62 | 62 | ]; |
@@ -249,11 +249,11 @@ discard block |
||
| 249 | 249 | // (D) First collect any conflicts between the provided collection of fields |
| 250 | 250 | // and the collection of fields represented by the given fragment. |
| 251 | 251 | $this->collectConflictsBetween( |
| 252 | - $context, |
|
| 253 | - $conflicts, |
|
| 254 | - $areMutuallyExclusive, |
|
| 255 | - $fieldMap, |
|
| 256 | - $fieldMap2 |
|
| 252 | + $context, |
|
| 253 | + $conflicts, |
|
| 254 | + $areMutuallyExclusive, |
|
| 255 | + $fieldMap, |
|
| 256 | + $fieldMap2 |
|
| 257 | 257 | ); |
| 258 | 258 | |
| 259 | 259 | // (E) Then collect any conflicts between the provided collection of fields |
@@ -327,11 +327,11 @@ discard block |
||
| 327 | 327 | // (F) First, collect all conflicts between these two collections of fields |
| 328 | 328 | // (not including any nested fragments). |
| 329 | 329 | $this->collectConflictsBetween( |
| 330 | - $context, |
|
| 331 | - $conflicts, |
|
| 332 | - $areMutuallyExclusive, |
|
| 333 | - $fieldMap1, |
|
| 334 | - $fieldMap2 |
|
| 330 | + $context, |
|
| 331 | + $conflicts, |
|
| 332 | + $areMutuallyExclusive, |
|
| 333 | + $fieldMap1, |
|
| 334 | + $fieldMap2 |
|
| 335 | 335 | ); |
| 336 | 336 | |
| 337 | 337 | // (G) Then collect conflicts between the first fragment and any nested |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | static function reasonMessage($reason) |
| 34 | 34 | { |
| 35 | 35 | if (is_array($reason)) { |
| 36 | - $tmp = array_map(function ($tmp) { |
|
| 36 | + $tmp = array_map(function($tmp) { |
|
| 37 | 37 | list($responseName, $subReason) = $tmp; |
| 38 | 38 | $reasonMessage = self::reasonMessage($subReason); |
| 39 | 39 | return "subfields \"$responseName\" conflict because $reasonMessage"; |
@@ -692,23 +692,19 @@ discard block |
||
| 692 | 692 | { |
| 693 | 693 | if ($type1 instanceof ListOfType) { |
| 694 | 694 | return $type2 instanceof ListOfType ? |
| 695 | - $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : |
|
| 696 | - true; |
|
| 695 | + $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : true; |
|
| 697 | 696 | } |
| 698 | 697 | if ($type2 instanceof ListOfType) { |
| 699 | 698 | return $type1 instanceof ListOfType ? |
| 700 | - $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : |
|
| 701 | - true; |
|
| 699 | + $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : true; |
|
| 702 | 700 | } |
| 703 | 701 | if ($type1 instanceof NonNull) { |
| 704 | 702 | return $type2 instanceof NonNull ? |
| 705 | - $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : |
|
| 706 | - true; |
|
| 703 | + $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : true; |
|
| 707 | 704 | } |
| 708 | 705 | if ($type2 instanceof NonNull) { |
| 709 | 706 | return $type1 instanceof NonNull ? |
| 710 | - $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : |
|
| 711 | - true; |
|
| 707 | + $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : true; |
|
| 712 | 708 | } |
| 713 | 709 | if (Type::isLeafType($type1) || Type::isLeafType($type2)) { |
| 714 | 710 | return $type1 !== $type2; |
@@ -858,20 +854,20 @@ discard block |
||
| 858 | 854 | return [ |
| 859 | 855 | [ |
| 860 | 856 | $responseName, |
| 861 | - array_map(function ($conflict) { |
|
| 857 | + array_map(function($conflict) { |
|
| 862 | 858 | return $conflict[0]; |
| 863 | 859 | }, $conflicts), |
| 864 | 860 | ], |
| 865 | 861 | array_reduce( |
| 866 | 862 | $conflicts, |
| 867 | - function ($allFields, $conflict) { |
|
| 863 | + function($allFields, $conflict) { |
|
| 868 | 864 | return array_merge($allFields, $conflict[1]); |
| 869 | 865 | }, |
| 870 | 866 | [$ast1] |
| 871 | 867 | ), |
| 872 | 868 | array_reduce( |
| 873 | 869 | $conflicts, |
| 874 | - function ($allFields, $conflict) { |
|
| 870 | + function($allFields, $conflict) { |
|
| 875 | 871 | return array_merge($allFields, $conflict[2]); |
| 876 | 872 | }, |
| 877 | 873 | [$ast2] |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | static function duplicateDirectiveMessage($directiveName) |
| 12 | 12 | { |
| 13 | - return 'The directive "'.$directiveName.'" can only be used once at this location.'; |
|
| 13 | + return 'The directive "' . $directiveName . '" can only be used once at this location.'; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function getVisitor(ValidationContext $context) |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | $context, |
| 52 | 52 | [ |
| 53 | 53 | NodeKind::OPERATION_DEFINITION => [ |
| 54 | - 'leave' => function (OperationDefinitionNode $operationDefinition) use ($context) { |
|
| 54 | + 'leave' => function(OperationDefinitionNode $operationDefinition) use ($context) { |
|
| 55 | 55 | $maxDepth = $this->fieldDepth($operationDefinition); |
| 56 | 56 | |
| 57 | 57 | if ($maxDepth > $this->getMaxQueryDepth()) { |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | static function undefinedFieldMessage($fieldName, $type, array $suggestedTypeNames, array $suggestedFieldNames) |
| 17 | 17 | { |
| 18 | - $message = 'Cannot query field "' . $fieldName . '" on type "' . $type.'".'; |
|
| 18 | + $message = 'Cannot query field "' . $fieldName . '" on type "' . $type . '".'; |
|
| 19 | 19 | |
| 20 | 20 | if ($suggestedTypeNames) { |
| 21 | 21 | $suggestions = Utils::quotedOrList($suggestedTypeNames); |
@@ -86,14 +86,14 @@ discard block |
||
| 86 | 86 | $suggestedObjectTypes = []; |
| 87 | 87 | $interfaceUsageCount = []; |
| 88 | 88 | |
| 89 | - foreach($schema->getPossibleTypes($type) as $possibleType) { |
|
| 89 | + foreach ($schema->getPossibleTypes($type) as $possibleType) { |
|
| 90 | 90 | $fields = $possibleType->getFields(); |
| 91 | 91 | if (!isset($fields[$fieldName])) { |
| 92 | 92 | continue; |
| 93 | 93 | } |
| 94 | 94 | // This object type defines this field. |
| 95 | 95 | $suggestedObjectTypes[] = $possibleType->name; |
| 96 | - foreach($possibleType->getInterfaces() as $possibleInterface) { |
|
| 96 | + foreach ($possibleType->getInterfaces() as $possibleInterface) { |
|
| 97 | 97 | $fields = $possibleInterface->getFields(); |
| 98 | 98 | if (!isset($fields[$fieldName])) { |
| 99 | 99 | continue; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $parentType->name, |
| 52 | 52 | Utils::suggestionList( |
| 53 | 53 | $node->name->value, |
| 54 | - array_map(function ($arg) { return $arg->name; }, $fieldDef->args) |
|
| 54 | + array_map(function($arg) { return $arg->name; }, $fieldDef->args) |
|
| 55 | 55 | ) |
| 56 | 56 | ), |
| 57 | 57 | [$node] |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $directive->name, |
| 67 | 67 | Utils::suggestionList( |
| 68 | 68 | $node->name->value, |
| 69 | - array_map(function ($arg) { return $arg->name; }, $directive->args) |
|
| 69 | + array_map(function($arg) { return $arg->name; }, $directive->args) |
|
| 70 | 70 | ) |
| 71 | 71 | ), |
| 72 | 72 | [$node] |