@@ -75,7 +75,7 @@ |
||
75 | 75 | $column = $position + 1; |
76 | 76 | |
77 | 77 | $utfChars = json_decode('"\u2028\u2029"'); |
78 | - $lineRegexp = '/\r\n|[\n\r'.$utfChars.']/su'; |
|
78 | + $lineRegexp = '/\r\n|[\n\r' . $utfChars . ']/su'; |
|
79 | 79 | $matches = []; |
80 | 80 | preg_match_all($lineRegexp, mb_substr($this->body, 0, $position, 'UTF-8'), $matches, PREG_OFFSET_CAPTURE); |
81 | 81 |
@@ -53,7 +53,7 @@ |
||
53 | 53 | private static function leadingWhitespace($str) { |
54 | 54 | $i = 0; |
55 | 55 | while ($i < mb_strlen($str) && ($str[$i] === ' ' || $str[$i] === '\t')) { |
56 | - $i++; |
|
56 | + $i++; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return $i; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | return $this->standardStore[$offset]; |
158 | 158 | } |
159 | 159 | if (is_float($offset)) { |
160 | - return $this->floatStore[(string)$offset]; |
|
160 | + return $this->floatStore[(string) $offset]; |
|
161 | 161 | } |
162 | 162 | if (is_object($offset)) { |
163 | 163 | return $this->objectStore->offsetGet($offset); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } else if (is_int($offset) || is_string($offset)) { |
203 | 203 | $this->standardStore[$offset] = $value; |
204 | 204 | } else if (is_float($offset)) { |
205 | - $this->floatStore[(string)$offset] = $value; |
|
205 | + $this->floatStore[(string) $offset] = $value; |
|
206 | 206 | } else if (is_object($offset)) { |
207 | 207 | $this->objectStore[$offset] = $value; |
208 | 208 | } else if (is_array($offset)) { |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | } else if (is_int($offset) || is_string($offset)) { |
237 | 237 | unset($this->standardStore[$offset]); |
238 | 238 | } else if (is_float($offset)) { |
239 | - unset($this->floatStore[(string)$offset]); |
|
239 | + unset($this->floatStore[(string) $offset]); |
|
240 | 240 | } else if (is_object($offset)) { |
241 | 241 | $this->objectStore->offsetUnset($offset); |
242 | 242 | } else if (is_array($offset)) { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | function($type) { |
36 | 36 | return !Directive::isSpecifiedDirective($type); |
37 | 37 | }, |
38 | - function ($type) { |
|
38 | + function($type) { |
|
39 | 39 | return !Type::isBuiltInType($type); |
40 | 40 | }, |
41 | 41 | $options |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | private static function descriptionLines($description, $maxLen) { |
313 | 313 | $lines = []; |
314 | 314 | $rawLines = explode("\n", $description); |
315 | - foreach($rawLines as $line) { |
|
315 | + foreach ($rawLines as $line) { |
|
316 | 316 | if ($line === '') { |
317 | 317 | $lines[] = $line; |
318 | 318 | } else { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | if (!$type instanceof Type) { |
97 | 97 | Warning::warnOnce( |
98 | - 'One of the schema types is not a valid type definition instance. '. |
|
98 | + 'One of the schema types is not a valid type definition instance. ' . |
|
99 | 99 | 'Try running $schema->assertValid() to find out the cause of this warning.', |
100 | 100 | Warning::WARNING_NOT_A_TYPE |
101 | 101 | ); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | if (!empty($typeMap[$type->name])) { |
106 | 106 | Utils::invariant( |
107 | 107 | $typeMap[$type->name] === $type, |
108 | - "Schema must contain unique named types but contains multiple types named \"$type\" ". |
|
108 | + "Schema must contain unique named types but contains multiple types named \"$type\" " . |
|
109 | 109 | "(see http://webonyx.github.io/graphql-php/type-system/#type-registry)." |
110 | 110 | ); |
111 | 111 | return $typeMap; |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $fieldOrDirective = $this->getDirective() ?: $this->getFieldDef(); |
380 | 380 | $argDef = $argType = null; |
381 | 381 | if ($fieldOrDirective) { |
382 | - $argDef = Utils::find($fieldOrDirective->args, function($arg) use ($node) {return $arg->name === $node->name->value;}); |
|
382 | + $argDef = Utils::find($fieldOrDirective->args, function($arg) use ($node) {return $arg->name === $node->name->value; }); |
|
383 | 383 | if ($argDef) { |
384 | 384 | $argType = $argDef->getType(); |
385 | 385 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | return new Directive([ |
182 | 182 | 'name' => $directiveNode->name->value, |
183 | 183 | 'description' => $this->getDescription($directiveNode), |
184 | - 'locations' => Utils::map($directiveNode->locations, function ($node) { |
|
184 | + 'locations' => Utils::map($directiveNode->locations, function($node) { |
|
185 | 185 | return $node->value; |
186 | 186 | }), |
187 | 187 | 'args' => $directiveNode->arguments ? FieldArgument::createMap($this->makeInputValues($directiveNode->arguments)) : null, |
@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | return new ObjectType([ |
256 | 256 | 'name' => $typeName, |
257 | 257 | 'description' => $this->getDescription($def), |
258 | - 'fields' => function () use ($def) { |
|
258 | + 'fields' => function() use ($def) { |
|
259 | 259 | return $this->makeFieldDefMap($def); |
260 | 260 | }, |
261 | - 'interfaces' => function () use ($def) { |
|
261 | + 'interfaces' => function() use ($def) { |
|
262 | 262 | return $this->makeImplementedInterfaces($def); |
263 | 263 | }, |
264 | 264 | 'astNode' => $def |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | return $def->fields |
271 | 271 | ? Utils::keyValMap( |
272 | 272 | $def->fields, |
273 | - function ($field) { |
|
273 | + function($field) { |
|
274 | 274 | return $field->name->value; |
275 | 275 | }, |
276 | - function ($field) { |
|
276 | + function($field) { |
|
277 | 277 | return $this->buildField($field); |
278 | 278 | } |
279 | 279 | ) |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | // Note: While this could make early assertions to get the correctly |
287 | 287 | // typed values, that would throw immediately while type system |
288 | 288 | // validation with validateSchema() will produce more actionable results. |
289 | - return Utils::map($def->interfaces, function ($iface) { |
|
289 | + return Utils::map($def->interfaces, function($iface) { |
|
290 | 290 | return $this->buildType($iface); |
291 | 291 | }); |
292 | 292 | } |
@@ -297,10 +297,10 @@ discard block |
||
297 | 297 | { |
298 | 298 | return Utils::keyValMap( |
299 | 299 | $values, |
300 | - function ($value) { |
|
300 | + function($value) { |
|
301 | 301 | return $value->name->value; |
302 | 302 | }, |
303 | - function ($value) { |
|
303 | + function($value) { |
|
304 | 304 | // Note: While this could make assertions to get the correctly typed |
305 | 305 | // value, that would throw immediately while type system validation |
306 | 306 | // with validateSchema() will produce more actionable results. |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | return new InterfaceType([ |
326 | 326 | 'name' => $typeName, |
327 | 327 | 'description' => $this->getDescription($def), |
328 | - 'fields' => function () use ($def) { |
|
328 | + 'fields' => function() use ($def) { |
|
329 | 329 | return $this->makeFieldDefMap($def); |
330 | 330 | }, |
331 | 331 | 'astNode' => $def |
@@ -340,10 +340,10 @@ discard block |
||
340 | 340 | 'values' => $def->values |
341 | 341 | ? Utils::keyValMap( |
342 | 342 | $def->values, |
343 | - function ($enumValue) { |
|
343 | + function($enumValue) { |
|
344 | 344 | return $enumValue->name->value; |
345 | 345 | }, |
346 | - function ($enumValue) { |
|
346 | + function($enumValue) { |
|
347 | 347 | return [ |
348 | 348 | 'description' => $this->getDescription($enumValue), |
349 | 349 | 'deprecationReason' => $this->getDeprecationReason($enumValue), |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | // values below, that would throw immediately while type system |
366 | 366 | // validation with validateSchema() will produce more actionable results. |
367 | 367 | 'types' => $def->types |
368 | - ? Utils::map($def->types, function ($typeNode) { |
|
368 | + ? Utils::map($def->types, function($typeNode) { |
|
369 | 369 | return $this->buildType($typeNode); |
370 | 370 | }): |
371 | 371 | [], |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | return new InputObjectType([ |
391 | 391 | 'name' => $def->name->value, |
392 | 392 | 'description' => $this->getDescription($def), |
393 | - 'fields' => function () use ($def) { |
|
393 | + 'fields' => function() use ($def) { |
|
394 | 394 | return $def->fields |
395 | 395 | ? $this->makeInputValues($def->fields) |
396 | 396 | : []; |
@@ -470,7 +470,7 @@ |
||
470 | 470 | function($field) use ($variables) { return self::valueFromASTUntyped($field->value, $variables); }, |
471 | 471 | iterator_to_array($valueNode->fields) |
472 | 472 | ) |
473 | - ); |
|
473 | + ); |
|
474 | 474 | case $valueNode instanceof VariableNode: |
475 | 475 | $variableName = $valueNode->name->value; |
476 | 476 | return ($variables && isset($variables[$variableName])) |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | foreach ($node as $key => $value) { |
83 | 83 | if ('loc' === $key || 'kind' === $key) { |
84 | - continue ; |
|
84 | + continue; |
|
85 | 85 | } |
86 | 86 | if (is_array($value)) { |
87 | 87 | if (isset($value[0]) || empty($value)) { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | $coercedObj = []; |
366 | 366 | $fields = $type->getFields(); |
367 | - $fieldNodes = Utils::keyMap($valueNode->fields, function($field) {return $field->name->value;}); |
|
367 | + $fieldNodes = Utils::keyMap($valueNode->fields, function($field) {return $field->name->value; }); |
|
368 | 368 | foreach ($fields as $field) { |
369 | 369 | /** @var ValueNode $fieldNode */ |
370 | 370 | $fieldName = $field->name; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | // Invalid: intentionally return no value. |
378 | 378 | return $undefined; |
379 | 379 | } |
380 | - continue ; |
|
380 | + continue; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | $fieldValue = self::valueFromAST($fieldNode ? $fieldNode->value : null, $field->getType(), $variables); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $newArgs = $newTypeFields[$fieldName]->args; |
182 | 182 | $newArgDef = Utils::find( |
183 | 183 | $newArgs, |
184 | - function ($arg) use ($oldArgDef) { |
|
184 | + function($arg) use ($oldArgDef) { |
|
185 | 185 | return $arg->name === $oldArgDef->name; |
186 | 186 | } |
187 | 187 | ); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $oldArgs = $oldTypeFields[$fieldName]->args; |
216 | 216 | $oldArgDef = Utils::find( |
217 | 217 | $oldArgs, |
218 | - function ($arg) use ($newArgDef) { |
|
218 | + function($arg) use ($newArgDef) { |
|
219 | 219 | return $arg->name === $newArgDef->name; |
220 | 220 | } |
221 | 221 | ); |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | $oldInterfaces = $oldType->getInterfaces(); |
623 | 623 | $newInterfaces = $newType->getInterfaces(); |
624 | 624 | foreach ($oldInterfaces as $oldInterface) { |
625 | - if (!Utils::find($newInterfaces, function (InterfaceType $interface) use ($oldInterface) { |
|
625 | + if (!Utils::find($newInterfaces, function(InterfaceType $interface) use ($oldInterface) { |
|
626 | 626 | return $interface->name === $oldInterface->name; |
627 | 627 | })) { |
628 | 628 | $breakingChanges[] = [ |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | $oldInterfaces = $oldType->getInterfaces(); |
659 | 659 | $newInterfaces = $newType->getInterfaces(); |
660 | 660 | foreach ($newInterfaces as $newInterface) { |
661 | - if (!Utils::find($oldInterfaces, function (InterfaceType $interface) use ($newInterface) { |
|
661 | + if (!Utils::find($oldInterfaces, function(InterfaceType $interface) use ($newInterface) { |
|
662 | 662 | return $interface->name === $newInterface->name; |
663 | 663 | })) { |
664 | 664 | $interfacesAddedToObjectTypes[] = [ |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | $removedDirectives = []; |
677 | 677 | |
678 | 678 | $newSchemaDirectiveMap = self::getDirectiveMapForSchema($newSchema); |
679 | - foreach($oldSchema->getDirectives() as $directive) { |
|
679 | + foreach ($oldSchema->getDirectives() as $directive) { |
|
680 | 680 | if (!isset($newSchemaDirectiveMap[$directive->name])) { |
681 | 681 | $removedDirectives[] = [ |
682 | 682 | 'type' => self::BREAKING_CHANGE_DIRECTIVE_REMOVED, |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | { |
693 | 693 | $removedArgs = []; |
694 | 694 | $newArgMap = self::getArgumentMapForDirective($newDirective); |
695 | - foreach((array) $oldDirective->args as $arg) { |
|
695 | + foreach ((array) $oldDirective->args as $arg) { |
|
696 | 696 | if (!isset($newArgMap[$arg->name])) { |
697 | 697 | $removedArgs[] = $arg; |
698 | 698 | } |
@@ -706,12 +706,12 @@ discard block |
||
706 | 706 | $removedDirectiveArgs = []; |
707 | 707 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
708 | 708 | |
709 | - foreach($newSchema->getDirectives() as $newDirective) { |
|
709 | + foreach ($newSchema->getDirectives() as $newDirective) { |
|
710 | 710 | if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
711 | 711 | continue; |
712 | 712 | } |
713 | 713 | |
714 | - foreach(self::findRemovedArgsForDirectives($oldSchemaDirectiveMap[$newDirective->name], $newDirective) as $arg) { |
|
714 | + foreach (self::findRemovedArgsForDirectives($oldSchemaDirectiveMap[$newDirective->name], $newDirective) as $arg) { |
|
715 | 715 | $removedDirectiveArgs[] = [ |
716 | 716 | 'type' => self::BREAKING_CHANGE_DIRECTIVE_ARG_REMOVED, |
717 | 717 | 'description' => "{$arg->name} was removed from {$newDirective->name}", |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | { |
727 | 727 | $addedArgs = []; |
728 | 728 | $oldArgMap = self::getArgumentMapForDirective($oldDirective); |
729 | - foreach((array) $newDirective->args as $arg) { |
|
729 | + foreach ((array) $newDirective->args as $arg) { |
|
730 | 730 | if (!isset($oldArgMap[$arg->name])) { |
731 | 731 | $addedArgs[] = $arg; |
732 | 732 | } |
@@ -740,12 +740,12 @@ discard block |
||
740 | 740 | $addedNonNullableArgs = []; |
741 | 741 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
742 | 742 | |
743 | - foreach($newSchema->getDirectives() as $newDirective) { |
|
743 | + foreach ($newSchema->getDirectives() as $newDirective) { |
|
744 | 744 | if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
745 | 745 | continue; |
746 | 746 | } |
747 | 747 | |
748 | - foreach(self::findAddedArgsForDirective($oldSchemaDirectiveMap[$newDirective->name], $newDirective) as $arg) { |
|
748 | + foreach (self::findAddedArgsForDirective($oldSchemaDirectiveMap[$newDirective->name], $newDirective) as $arg) { |
|
749 | 749 | if (!$arg->getType() instanceof NonNull) { |
750 | 750 | continue; |
751 | 751 | } |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | { |
764 | 764 | $removedLocations = []; |
765 | 765 | $newLocationSet = array_flip($newDirective->locations); |
766 | - foreach($oldDirective->locations as $oldLocation) { |
|
766 | + foreach ($oldDirective->locations as $oldLocation) { |
|
767 | 767 | if (!array_key_exists($oldLocation, $newLocationSet)) { |
768 | 768 | $removedLocations[] = $oldLocation; |
769 | 769 | } |
@@ -777,12 +777,12 @@ discard block |
||
777 | 777 | $removedLocations = []; |
778 | 778 | $oldSchemaDirectiveMap = self::getDirectiveMapForSchema($oldSchema); |
779 | 779 | |
780 | - foreach($newSchema->getDirectives() as $newDirective) { |
|
780 | + foreach ($newSchema->getDirectives() as $newDirective) { |
|
781 | 781 | if (!isset($oldSchemaDirectiveMap[$newDirective->name])) { |
782 | 782 | continue; |
783 | 783 | } |
784 | 784 | |
785 | - foreach(self::findRemovedLocationsForDirective($oldSchemaDirectiveMap[$newDirective->name], $newDirective) as $location) { |
|
785 | + foreach (self::findRemovedLocationsForDirective($oldSchemaDirectiveMap[$newDirective->name], $newDirective) as $location) { |
|
786 | 786 | $removedLocations[] = [ |
787 | 787 | 'type' => self::BREAKING_CHANGE_DIRECTIVE_LOCATION_REMOVED, |
788 | 788 | 'description' => "{$location} was removed from {$newDirective->name}", |
@@ -795,11 +795,11 @@ discard block |
||
795 | 795 | |
796 | 796 | private static function getDirectiveMapForSchema(Schema $schema) |
797 | 797 | { |
798 | - return Utils::keyMap($schema->getDirectives(), function ($dir) { return $dir->name; }); |
|
798 | + return Utils::keyMap($schema->getDirectives(), function($dir) { return $dir->name; }); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | private static function getArgumentMapForDirective(Directive $directive) |
802 | 802 | { |
803 | - return Utils::keyMap($directive->args ?: [], function ($arg) { return $arg->name; }); |
|
803 | + return Utils::keyMap($directive->args ?: [], function($arg) { return $arg->name; }); |
|
804 | 804 | } |
805 | 805 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $defintionBuilder = new ASTDefinitionBuilder( |
103 | 103 | $this->nodeMap, |
104 | 104 | $this->options, |
105 | - function($typeName) { throw new Error('Type "'. $typeName . '" not found in document.'); }, |
|
105 | + function($typeName) { throw new Error('Type "' . $typeName . '" not found in document.'); }, |
|
106 | 106 | $this->typeConfigDecorator |
107 | 107 | ); |
108 | 108 | |
@@ -111,21 +111,21 @@ discard block |
||
111 | 111 | }, $directiveDefs); |
112 | 112 | |
113 | 113 | // If specified directives were not explicitly declared, add them. |
114 | - $skip = array_reduce($directives, function ($hasSkip, $directive) { |
|
114 | + $skip = array_reduce($directives, function($hasSkip, $directive) { |
|
115 | 115 | return $hasSkip || $directive->name == 'skip'; |
116 | 116 | }); |
117 | 117 | if (!$skip) { |
118 | 118 | $directives[] = Directive::skipDirective(); |
119 | 119 | } |
120 | 120 | |
121 | - $include = array_reduce($directives, function ($hasInclude, $directive) { |
|
121 | + $include = array_reduce($directives, function($hasInclude, $directive) { |
|
122 | 122 | return $hasInclude || $directive->name == 'include'; |
123 | 123 | }); |
124 | 124 | if (!$include) { |
125 | 125 | $directives[] = Directive::includeDirective(); |
126 | 126 | } |
127 | 127 | |
128 | - $deprecated = array_reduce($directives, function ($hasDeprecated, $directive) { |
|
128 | + $deprecated = array_reduce($directives, function($hasDeprecated, $directive) { |
|
129 | 129 | return $hasDeprecated || $directive->name == 'deprecated'; |
130 | 130 | }); |
131 | 131 | if (!$deprecated) { |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | 'subscription' => isset($operationTypes['subscription']) |
147 | 147 | ? $defintionBuilder->buildType($operationTypes['subscription']) |
148 | 148 | : null, |
149 | - 'typeLoader' => function ($name) use ($defintionBuilder) { |
|
149 | + 'typeLoader' => function($name) use ($defintionBuilder) { |
|
150 | 150 | return $defintionBuilder->buildType($name); |
151 | 151 | }, |
152 | 152 | 'directives' => $directives, |
153 | 153 | 'astNode' => $schemaDef, |
154 | - 'types' => function () use ($defintionBuilder) { |
|
154 | + 'types' => function() use ($defintionBuilder) { |
|
155 | 155 | $types = []; |
156 | 156 | foreach ($this->nodeMap as $name => $def) { |
157 | 157 | $types[] = $defintionBuilder->buildType($def->name->value); |