@@ -10,9 +10,7 @@ |
||
10 | 10 | |
11 | 11 | |
12 | 12 | use Youshido\GraphQL\Config\Schema\SchemaConfig; |
13 | -use Youshido\GraphQL\Type\Object\ObjectType; |
|
14 | 13 | use Youshido\GraphQL\Type\SchemaTypesList; |
15 | -use Youshido\GraphQL\Type\TypeInterface; |
|
16 | 14 | use Youshido\GraphQL\Type\SchemaDirectivesList; |
17 | 15 | |
18 | 16 | abstract class AbstractSchema |
@@ -60,7 +60,7 @@ |
||
60 | 60 | |
61 | 61 | public function getValidationError($value = null) |
62 | 62 | { |
63 | - $allowedValues = array_map(function (array $value) { |
|
63 | + $allowedValues = array_map(function(array $value) { |
|
64 | 64 | return sprintf('%s (%s)', $value['name'], $value['value']); |
65 | 65 | }, $this->getConfig()->get('values')); |
66 | 66 | return sprintf('Value must be one of the allowed ones: %s', implode(', ', $allowedValues)); |
@@ -59,7 +59,7 @@ |
||
59 | 59 | 'type' => new NonNullType(new ListType(new NonNullType(new InputValueType()))), |
60 | 60 | 'resolve' => [$this, 'resolveArgs'], |
61 | 61 | ]) |
62 | - ->addField('locations',[ |
|
62 | + ->addField('locations', [ |
|
63 | 63 | 'type' => new NonNullType(new ListType(new NonNullType(new DirectiveLocationType()))), |
64 | 64 | 'resolve' => [$this, 'resolveLocations'], |
65 | 65 | ]); |
@@ -253,9 +253,9 @@ |
||
253 | 253 | $value = substr($this->source, $start, $this->pos - $start); |
254 | 254 | |
255 | 255 | if (strpos($value, '.') === false) { |
256 | - $value = (int) $value; |
|
256 | + $value = (int)$value; |
|
257 | 257 | } else { |
258 | - $value = (float) $value; |
|
258 | + $value = (float)$value; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | return new Token(Token::TYPE_NUMBER, $this->getLine(), $this->getColumn(), $value); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | protected function findVariable($name) |
237 | 237 | { |
238 | - foreach ((array) $this->data['variables'] as $variable) { |
|
238 | + foreach ((array)$this->data['variables'] as $variable) { |
|
239 | 239 | /** @var $variable Variable */ |
240 | 240 | if ($variable->getName() === $name) { |
241 | 241 | return $variable; |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | |
479 | 479 | protected function matchMulti($types) |
480 | 480 | { |
481 | - foreach ((array) $types as $type) { |
|
481 | + foreach ((array)$types as $type) { |
|
482 | 482 | if ($this->peek()->getType() === $type) { |
483 | 483 | return true; |
484 | 484 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | /** @var AbstractObjectType $objectType */ |
28 | 28 | if (!(TypeService::isObjectType($objectType) || TypeService::isInputObjectType($objectType)) || !$objectType->hasField($ast->getName())) { |
29 | - $availableFieldNames = implode(', ', array_map(function (FieldInterface $field) { |
|
29 | + $availableFieldNames = implode(', ', array_map(function(FieldInterface $field) { |
|
30 | 30 | return sprintf('"%s"', $field->getName()); |
31 | 31 | }, $objectType->getFields())); |
32 | 32 | throw new ResolveException(sprintf('Field "%s" not found in type "%s". Available fields are: %s', $ast->getName(), $objectType->getNamedType()->getName(), $availableFieldNames), $ast->getLocation()); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | public function assertValidArguments(FieldInterface $field, AstFieldInterface $query, Request $request) |
37 | 37 | { |
38 | - $requiredArguments = array_filter($field->getArguments(), function (InputField $argument) { |
|
38 | + $requiredArguments = array_filter($field->getArguments(), function(InputField $argument) { |
|
39 | 39 | return $argument->getType()->getKind() === TypeMap::KIND_NON_NULL; |
40 | 40 | }); |
41 | 41 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | { |
22 | 22 | public function testMethods() |
23 | 23 | { |
24 | - $fieldAst = new FieldAST('name', null, [], [], new Location(1,1)); |
|
24 | + $fieldAst = new FieldAST('name', null, [], [], new Location(1, 1)); |
|
25 | 25 | $field = new Field(['name' => 'id', 'type' => new IntType()]); |
26 | 26 | $returnType = new IntType(); |
27 | 27 | $executionContext = new ExecutionContext(new TestSchema()); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | 'description' => 'latest description', |
137 | 137 | 'deprecationReason' => 'for test', |
138 | 138 | 'isDeprecated' => true, |
139 | - 'resolve' => function () { |
|
139 | + 'resolve' => function() { |
|
140 | 140 | return [ |
141 | 141 | 'id' => 1, |
142 | 142 | 'name' => 'Alex' |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | ['name' => 'String', 'fields' => null], |
203 | 203 | ['name' => '__Schema', 'fields' => [['name' => 'queryType', 'args' => []], ['name' => 'mutationType', 'args' => []], ['name' => 'subscriptionType', 'args' => []], ['name' => 'types', 'args' => []], ['name' => 'directives', 'args' => []]]], |
204 | 204 | ['name' => '__Type', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'kind', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'ofType', 'args' => []], ['name' => 'inputFields', 'args' => []], ['name' => 'enumValues', 'args' => [['defaultValue' => 'false']]], ['name' => 'fields', 'args' => [['defaultValue' => 'false']]], ['name' => 'interfaces', 'args' => []], ['name' => 'possibleTypes', 'args' => []]]], |
205 | - ['name' => '__InputValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'defaultValue', 'args' => []],]], |
|
205 | + ['name' => '__InputValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'defaultValue', 'args' => []], ]], |
|
206 | 206 | ['name' => 'Boolean', 'fields' => null], |
207 | - ['name' => '__EnumValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'isDeprecated', 'args' => []],]], |
|
207 | + ['name' => '__EnumValue', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ]], |
|
208 | 208 | ['name' => '__Field', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'isDeprecated', 'args' => []], ['name' => 'deprecationReason', 'args' => []], ['name' => 'type', 'args' => []], ['name' => 'args', 'args' => []]]], |
209 | 209 | ['name' => '__Directive', 'fields' => [['name' => 'name', 'args' => []], ['name' => 'description', 'args' => []], ['name' => 'args', 'args' => []], ['name' => 'locations', 'args' => []]]], |
210 | 210 | ['name' => '__DirectiveLocation', 'fields' => null], |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | 'id' => ['type' => new IntType()], |
293 | 293 | 'name' => ['type' => new IntType()], |
294 | 294 | ], |
295 | - 'resolveType' => function ($type) { |
|
295 | + 'resolveType' => function($type) { |
|
296 | 296 | |
297 | 297 | } |
298 | 298 | ]); |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $unionType = new UnionType([ |
321 | 321 | 'name' => 'UnionType', |
322 | 322 | 'types' => [$object1, $object2], |
323 | - 'resolveType' => function () { |
|
323 | + 'resolveType' => function() { |
|
324 | 324 | |
325 | 325 | } |
326 | 326 | ]); |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | 'args' => [ |
332 | 332 | 'id' => ['type' => TypeMap::TYPE_INT] |
333 | 333 | ], |
334 | - 'resolve' => function () { |
|
334 | + 'resolve' => function() { |
|
335 | 335 | return [ |
336 | 336 | 'id' => 1, |
337 | 337 | 'name' => 'Alex' |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | ] |
358 | 358 | ]) |
359 | 359 | ], |
360 | - 'resolve' => function () { |
|
360 | + 'resolve' => function() { |
|
361 | 361 | return null; |
362 | 362 | } |
363 | 363 | ])); |
@@ -112,7 +112,7 @@ |
||
112 | 112 | new Argument('test2', new VariableReference('test2', $variable2, new Location(1, 1)), new Location(1, 1)), |
113 | 113 | ], [ |
114 | 114 | new Field('test', null, [], [], new Location(1, 1)) |
115 | - ], [], new Location(1,1)) |
|
115 | + ], [], new Location(1, 1)) |
|
116 | 116 | ], |
117 | 117 | 'variables' => [ |
118 | 118 | $variable1, |