@@ -33,7 +33,7 @@ |
||
33 | 33 | |
34 | 34 | public function assertValidArguments(FieldInterface $field, AstFieldInterface $query, Request $request) |
35 | 35 | { |
36 | - $requiredArguments = array_filter($field->getArguments(), function (InputField $argument) { |
|
36 | + $requiredArguments = array_filter($field->getArguments(), function(InputField $argument) { |
|
37 | 37 | return $argument->getType()->getKind() == TypeMap::KIND_NON_NULL; |
38 | 38 | }); |
39 | 39 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | $typeConfig = $this->getConfig(); |
55 | - $requiredFields = array_filter($typeConfig->getFields(), function (FieldInterface $field) { |
|
55 | + $requiredFields = array_filter($typeConfig->getFields(), function(FieldInterface $field) { |
|
56 | 56 | return $field->getType()->getKind() == TypeMap::KIND_NON_NULL; |
57 | 57 | }); |
58 | 58 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | public function parseValue($value) |
83 | 83 | { |
84 | - if($value instanceof InputObject) { |
|
84 | + if ($value instanceof InputObject) { |
|
85 | 85 | $value = $value->getValue(); |
86 | 86 | } |
87 | 87 |
@@ -2,18 +2,13 @@ |
||
2 | 2 | |
3 | 3 | namespace Youshido\Tests\Schema; |
4 | 4 | |
5 | -use Youshido\GraphQL\Config\Object\InterfaceTypeConfig; |
|
6 | -use Youshido\GraphQL\Config\Object\ObjectTypeConfig; |
|
7 | 5 | use Youshido\GraphQL\Execution\Processor; |
8 | 6 | use Youshido\GraphQL\Schema\Schema; |
9 | 7 | use Youshido\GraphQL\Type\InterfaceType\AbstractInterfaceType; |
10 | -use Youshido\GraphQL\Type\InterfaceType\InterfaceType; |
|
11 | 8 | use Youshido\GraphQL\Type\ListType\ListType; |
12 | -use Youshido\GraphQL\Type\NonNullType; |
|
13 | 9 | use Youshido\GraphQL\Type\Object\AbstractObjectType; |
14 | 10 | use Youshido\GraphQL\Type\Object\ObjectType; |
15 | 11 | use Youshido\GraphQL\Type\Scalar\IdType; |
16 | -use Youshido\GraphQL\Type\Scalar\IntType; |
|
17 | 12 | use Youshido\GraphQL\Type\Scalar\StringType; |
18 | 13 | |
19 | 14 |
@@ -103,7 +103,7 @@ |
||
103 | 103 | 'fields' => [ |
104 | 104 | 'user' => [ |
105 | 105 | 'type' => new UserType(), |
106 | - 'resolve' => function ($args) { |
|
106 | + 'resolve' => function($args) { |
|
107 | 107 | return [ |
108 | 108 | 'id' => 'user-id-1', |
109 | 109 | 'fullName' => 'Alex', |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | 'fields' => [ |
49 | 49 | 'nonNullScalar' => [ |
50 | 50 | 'type' => new NonNullType(new IntType()), |
51 | - 'resolve' => function () { |
|
51 | + 'resolve' => function() { |
|
52 | 52 | return null; |
53 | 53 | }, |
54 | 54 | ], |
55 | 55 | 'nonNullList' => [ |
56 | 56 | 'type' => new NonNullType(new ListType(new IntType())), |
57 | - 'resolve' => function () { |
|
57 | + 'resolve' => function() { |
|
58 | 58 | return null; |
59 | 59 | } |
60 | 60 | ], |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | 'name' => new StringType(), |
67 | 67 | ] |
68 | 68 | ])), |
69 | - 'resolve' => function () { |
|
69 | + 'resolve' => function() { |
|
70 | 70 | return [ |
71 | 71 | 'id' => new uid('6cfb044c-9c0a-4ddd-9ef8-a0b940818db3'), |
72 | 72 | 'name' => 'Alex' |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ], |
76 | 76 | 'nonNullListOfNpnNull' => [ |
77 | 77 | 'type' => new NonNullType(new ListType(new NonNullType(new IntType()))), |
78 | - 'resolve' => function () { |
|
78 | + 'resolve' => function() { |
|
79 | 79 | return [1, null]; |
80 | 80 | } |
81 | 81 | ], |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | 'fields' => [ |
30 | 30 | 'currentTime' => [ |
31 | 31 | 'type' => new StringType(), |
32 | - 'resolve' => function ($value, $args, $type) { |
|
32 | + 'resolve' => function($value, $args, $type) { |
|
33 | 33 | return 'May 5, 9:00am'; |
34 | 34 | }, |
35 | 35 | 'args' => [ |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $this->assertEquals(1, count($schema->getMutationType()->getFields())); |
60 | 60 | |
61 | - $schema->addMutationField('changeUser', ['type' => new TestObjectType(), 'resolve' => function () { }]); |
|
61 | + $schema->addMutationField('changeUser', ['type' => new TestObjectType(), 'resolve' => function() { }]); |
|
62 | 62 | $this->assertEquals(2, count($schema->getMutationType()->getFields())); |
63 | 63 | |
64 | 64 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | 'fields' => [ |
90 | 90 | 'name' => new StringType(), |
91 | 91 | ], |
92 | - 'resolveType' => function () use ($authorType) { |
|
92 | + 'resolveType' => function() use ($authorType) { |
|
93 | 93 | return $authorType; |
94 | 94 | } |
95 | 95 | ]); |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | 'interfaces' => [$userInterface] |
103 | 103 | ]); |
104 | 104 | |
105 | - $schema = new Schema([ |
|
105 | + $schema = new Schema([ |
|
106 | 106 | 'query' => new ObjectType([ |
107 | 107 | 'name' => 'QueryType', |
108 | 108 | 'fields' => [ |
109 | 109 | 'user' => [ |
110 | 110 | 'type' => $userInterface, |
111 | - 'resolve' => function () { |
|
111 | + 'resolve' => function() { |
|
112 | 112 | return [ |
113 | 113 | 'name' => 'Alex' |
114 | 114 | ]; |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | $processor->processPayload('{ user { name { } } }'); |
136 | 136 | $result = $processor->getResponseData(); |
137 | 137 | |
138 | - $this->assertEquals(['errors' => [ ['message' => 'Unexpected token "RBRACE" at (1:19)']]], $result); |
|
138 | + $this->assertEquals(['errors' => [['message' => 'Unexpected token "RBRACE" at (1:19)']]], $result); |
|
139 | 139 | $processor->getExecutionContext()->clearErrors(); |
140 | 140 | |
141 | 141 | $processor->processPayload('{ user { name { invalidSelection } } }'); |
142 | 142 | $result = $processor->getResponseData(); |
143 | 143 | |
144 | - $this->assertEquals(['data' => ['user' => null], 'errors' => [ ['message' => 'You can\'t specify fields for scalar type "String"']]], $result); |
|
144 | + $this->assertEquals(['data' => ['user' => null], 'errors' => [['message' => 'You can\'t specify fields for scalar type "String"']]], $result); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | } |
@@ -103,7 +103,7 @@ |
||
103 | 103 | 'fields' => [ |
104 | 104 | 'user' => [ |
105 | 105 | 'type' => new UserType(), |
106 | - 'resolve' => function ($args) { |
|
106 | + 'resolve' => function($args) { |
|
107 | 107 | return [ |
108 | 108 | 'id' => 'user-id-1', |
109 | 109 | 'fullName' => 'Alex', |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | ] |
81 | 81 | ]); |
82 | 82 | |
83 | - $finalConfig = new TestConfig(['name' => $name . 'final', 'resolve' => function () { return []; }], $object, true); |
|
83 | + $finalConfig = new TestConfig(['name' => $name.'final', 'resolve' => function() { return []; }], $object, true); |
|
84 | 84 | $this->assertEquals($finalConfig->getType(), null); |
85 | 85 | |
86 | 86 | $rules['resolve']['required'] = true; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function testFinalRule() |
102 | 102 | { |
103 | - ConfigValidator::getInstance()->assertValidConfig(new TestConfig(['name' => 'Test' . 'final'], null, true)); |
|
103 | + ConfigValidator::getInstance()->assertValidConfig(new TestConfig(['name' => 'Test'.'final'], null, true)); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | ] |
128 | 128 | ] |
129 | 129 | ]); |
130 | - $object = new ObjectType([ |
|
130 | + $object = new ObjectType([ |
|
131 | 131 | 'name' => 'Project', |
132 | 132 | 'fields' => [ |
133 | 133 | 'id' => new IdType(), |
@@ -30,7 +30,7 @@ |
||
30 | 30 | 'from' => new DateTimeType(), |
31 | 31 | 'fromtz' => new DateTimeTzType(), |
32 | 32 | ], |
33 | - 'resolve' => function ($source, $args) { |
|
33 | + 'resolve' => function($source, $args) { |
|
34 | 34 | return sprintf('Result with %s date and %s tz', |
35 | 35 | empty($args['from']) ? 'default' : $args['from'], |
36 | 36 | empty($args['fromtz']) ? 'default' : $args['fromtz'] |