@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * http://opensource.org/licenses/MIT |
10 | 10 | */ |
11 | 11 | |
12 | -declare(strict_types=1); |
|
12 | +declare(strict_types = 1); |
|
13 | 13 | /* |
14 | 14 | * This file is a part of GraphQL project. |
15 | 15 | * |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | 'fields' => [ |
54 | 54 | 'posts' => [ |
55 | 55 | 'type' => new ListType($postType), |
56 | - 'resolve' => function ($source, $args, $info) { |
|
56 | + 'resolve' => function($source, $args, $info) { |
|
57 | 57 | return $this->getDataForPosts(); |
58 | 58 | }, |
59 | 59 | ], |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * http://opensource.org/licenses/MIT |
10 | 10 | */ |
11 | 11 | |
12 | -declare(strict_types=1); |
|
12 | +declare(strict_types = 1); |
|
13 | 13 | |
14 | 14 | namespace Youshido\Tests\Schema; |
15 | 15 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | 'args' => [ |
35 | 35 | 'ids' => new ListType(new NonNullType(new IdType())), |
36 | 36 | ], |
37 | - 'resolve' => static function () { |
|
37 | + 'resolve' => static function() { |
|
38 | 38 | return 'item'; |
39 | 39 | }, |
40 | 40 | ], |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'args' => [ |
112 | 112 | 'sortOrder' => new StringType(), |
113 | 113 | ], |
114 | - 'resolve' => static function ($args) { |
|
114 | + 'resolve' => static function($args) { |
|
115 | 115 | return \sprintf('Result with %s order', empty($args['sortOrder']) ? 'default' : $args['sortOrder']); |
116 | 116 | }, |
117 | 117 | ], |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | if (!\array_key_exists($resultId, $this->results)) { |
75 | 75 | $query = \array_unique( |
76 | - \array_reduce($this->buffer, 'array_merge', []) |
|
76 | + \array_reduce($this->buffer, 'array_merge', []) |
|
77 | 77 | ); |
78 | 78 | \sort($query); |
79 | 79 | $result = $this->database->query($query); |
@@ -106,43 +106,43 @@ discard block |
||
106 | 106 | public function build($config): void |
107 | 107 | { |
108 | 108 | $config->addField( |
109 | - new Field( |
|
109 | + new Field( |
|
110 | 110 | [ |
111 | - 'name' => 'name', |
|
112 | - 'type' => new StringType(), |
|
113 | - 'resolve' => static function ($value) { |
|
114 | - return $value['name']; |
|
115 | - }, |
|
111 | + 'name' => 'name', |
|
112 | + 'type' => new StringType(), |
|
113 | + 'resolve' => static function ($value) { |
|
114 | + return $value['name']; |
|
115 | + }, |
|
116 | 116 | ] |
117 | - ) |
|
117 | + ) |
|
118 | 118 | ); |
119 | 119 | |
120 | 120 | $config->addField( |
121 | - new Field( |
|
121 | + new Field( |
|
122 | 122 | [ |
123 | - 'name' => 'friends', |
|
124 | - 'type' => new ListType(new self($this->database)), |
|
125 | - 'resolve' => function ($value) { |
|
126 | - return new DeferredResolver( |
|
123 | + 'name' => 'friends', |
|
124 | + 'type' => new ListType(new self($this->database)), |
|
125 | + 'resolve' => function ($value) { |
|
126 | + return new DeferredResolver( |
|
127 | 127 | $this->database->add($value['friends']) |
128 | - ); |
|
129 | - }, |
|
128 | + ); |
|
129 | + }, |
|
130 | 130 | ] |
131 | - ) |
|
131 | + ) |
|
132 | 132 | ); |
133 | 133 | |
134 | 134 | $config->addField( |
135 | - new Field( |
|
135 | + new Field( |
|
136 | 136 | [ |
137 | - 'name' => 'foes', |
|
138 | - 'type' => new ListType(new self($this->database)), |
|
139 | - 'resolve' => function ($value) { |
|
140 | - return new DeferredResolver( |
|
137 | + 'name' => 'foes', |
|
138 | + 'type' => new ListType(new self($this->database)), |
|
139 | + 'resolve' => function ($value) { |
|
140 | + return new DeferredResolver( |
|
141 | 141 | $this->database->add($value['foes']) |
142 | - ); |
|
143 | - }, |
|
142 | + ); |
|
143 | + }, |
|
144 | 144 | ] |
145 | - ) |
|
145 | + ) |
|
146 | 146 | ); |
147 | 147 | } |
148 | 148 | } |
@@ -152,30 +152,30 @@ discard block |
||
152 | 152 | public function __construct(DeferredQueryBuffer $buffer) |
153 | 153 | { |
154 | 154 | $usersField = new Field( |
155 | - [ |
|
155 | + [ |
|
156 | 156 | 'name' => 'users', |
157 | 157 | 'type' => new ListType(new DeferredUserType($buffer)), |
158 | 158 | 'resolve' => static function ($value, $args) use ($buffer) { |
159 | 159 | return new DeferredResolver($buffer->add($args['ids'])); |
160 | 160 | }, |
161 | - ] |
|
161 | + ] |
|
162 | 162 | ); |
163 | 163 | |
164 | 164 | $usersField->addArgument( |
165 | - 'ids', |
|
166 | - [ |
|
165 | + 'ids', |
|
166 | + [ |
|
167 | 167 | 'type' => new ListType(new StringType()), |
168 | - ] |
|
168 | + ] |
|
169 | 169 | ); |
170 | 170 | parent::__construct( |
171 | - [ |
|
171 | + [ |
|
172 | 172 | 'query' => new ObjectType( |
173 | - [ |
|
173 | + [ |
|
174 | 174 | 'name' => 'RootQuery', |
175 | 175 | 'fields' => [$usersField], |
176 | - ] |
|
176 | + ] |
|
177 | 177 | ), |
178 | - ] |
|
178 | + ] |
|
179 | 179 | ); |
180 | 180 | } |
181 | 181 | |
@@ -208,28 +208,28 @@ discard block |
||
208 | 208 | $database = $this->prophesize(DeferredDatabase::class); |
209 | 209 | |
210 | 210 | $database->query(['a', 'b'])->willReturn( |
211 | - [ |
|
211 | + [ |
|
212 | 212 | 'a' => ['id' => 'a', 'name' => 'User A'], |
213 | 213 | 'b' => ['id' => 'b', 'name' => 'User B'], |
214 | - ] |
|
214 | + ] |
|
215 | 215 | )->shouldBeCalledTimes(1); |
216 | 216 | |
217 | 217 | $result = $this->query( |
218 | - $query, |
|
219 | - new DeferredQueryBuffer($database->reveal()) |
|
218 | + $query, |
|
219 | + new DeferredQueryBuffer($database->reveal()) |
|
220 | 220 | ); |
221 | 221 | |
222 | 222 | $database->checkProphecyMethodsPredictions(); |
223 | 223 | |
224 | 224 | $this->assertEquals( |
225 | - [ |
|
225 | + [ |
|
226 | 226 | 'users' => [ |
227 | - ['name' => 'User A'], |
|
228 | - ['name' => 'User B'], |
|
227 | + ['name' => 'User A'], |
|
228 | + ['name' => 'User B'], |
|
229 | + ], |
|
229 | 230 | ], |
230 | - ], |
|
231 | - $result['data'], |
|
232 | - 'Retrieved correct data.' |
|
231 | + $result['data'], |
|
232 | + 'Retrieved correct data.' |
|
233 | 233 | ); |
234 | 234 | } |
235 | 235 | |
@@ -250,30 +250,30 @@ discard block |
||
250 | 250 | $database = $this->prophesize(DeferredDatabase::class); |
251 | 251 | |
252 | 252 | $database->query(['a', 'b'])->willReturn( |
253 | - [ |
|
253 | + [ |
|
254 | 254 | 'a' => ['id' => 'a', 'name' => 'User A'], |
255 | 255 | 'b' => ['id' => 'b', 'name' => 'User B'], |
256 | - ] |
|
256 | + ] |
|
257 | 257 | )->shouldBeCalledTimes(1); |
258 | 258 | |
259 | 259 | $result = $this->query( |
260 | - $query, |
|
261 | - new DeferredQueryBuffer($database->reveal()) |
|
260 | + $query, |
|
261 | + new DeferredQueryBuffer($database->reveal()) |
|
262 | 262 | ); |
263 | 263 | |
264 | 264 | $database->checkProphecyMethodsPredictions(); |
265 | 265 | |
266 | 266 | $this->assertEquals( |
267 | - [ |
|
267 | + [ |
|
268 | 268 | 'a' => [ |
269 | - ['name' => 'User A'], |
|
269 | + ['name' => 'User A'], |
|
270 | 270 | ], |
271 | 271 | 'b' => [ |
272 | - ['name' => 'User B'], |
|
272 | + ['name' => 'User B'], |
|
273 | + ], |
|
273 | 274 | ], |
274 | - ], |
|
275 | - $result['data'], |
|
276 | - 'Retrieved correct data.' |
|
275 | + $result['data'], |
|
276 | + 'Retrieved correct data.' |
|
277 | 277 | ); |
278 | 278 | } |
279 | 279 | |
@@ -294,39 +294,39 @@ discard block |
||
294 | 294 | $database = $this->prophesize(DeferredDatabase::class); |
295 | 295 | |
296 | 296 | $database->query(['a'])->willReturn( |
297 | - [ |
|
297 | + [ |
|
298 | 298 | 'a' => ['id' => 'a', 'name' => 'User A', 'friends' => ['b', 'c']], |
299 | - ] |
|
299 | + ] |
|
300 | 300 | )->shouldBeCalledTimes(1); |
301 | 301 | |
302 | 302 | $database->query(['b', 'c'])->willReturn( |
303 | - [ |
|
303 | + [ |
|
304 | 304 | 'b' => ['id' => 'b', 'name' => 'User B'], |
305 | 305 | 'c' => ['id' => 'c', 'name' => 'User C'], |
306 | - ] |
|
306 | + ] |
|
307 | 307 | ); |
308 | 308 | |
309 | 309 | $result = $this->query( |
310 | - $query, |
|
311 | - new DeferredQueryBuffer($database->reveal()) |
|
310 | + $query, |
|
311 | + new DeferredQueryBuffer($database->reveal()) |
|
312 | 312 | ); |
313 | 313 | |
314 | 314 | $database->checkProphecyMethodsPredictions(); |
315 | 315 | |
316 | 316 | $this->assertEquals( |
317 | - [ |
|
317 | + [ |
|
318 | 318 | 'a' => [ |
319 | - [ |
|
319 | + [ |
|
320 | 320 | 'name' => 'User A', |
321 | 321 | 'friends' => [ |
322 | - ['name' => 'User B'], |
|
323 | - ['name' => 'User C'], |
|
322 | + ['name' => 'User B'], |
|
323 | + ['name' => 'User C'], |
|
324 | + ], |
|
324 | 325 | ], |
325 | - ], |
|
326 | 326 | ], |
327 | - ], |
|
328 | - $result['data'], |
|
329 | - 'Retrieved correct data.' |
|
327 | + ], |
|
328 | + $result['data'], |
|
329 | + 'Retrieved correct data.' |
|
330 | 330 | ); |
331 | 331 | } |
332 | 332 | |
@@ -359,68 +359,68 @@ discard block |
||
359 | 359 | $database = $this->prophesize(DeferredDatabase::class); |
360 | 360 | |
361 | 361 | $database->query(['a', 'b'])->willReturn( |
362 | - [ |
|
362 | + [ |
|
363 | 363 | 'a' => [ |
364 | - 'id' => 'a', |
|
365 | - 'name' => 'User A', |
|
366 | - 'friends' => ['b', 'c'], |
|
367 | - 'foes' => ['d', 'e'], |
|
364 | + 'id' => 'a', |
|
365 | + 'name' => 'User A', |
|
366 | + 'friends' => ['b', 'c'], |
|
367 | + 'foes' => ['d', 'e'], |
|
368 | 368 | ], |
369 | 369 | 'b' => [ |
370 | - 'id' => 'b', |
|
371 | - 'name' => 'User B', |
|
372 | - 'friends' => ['a'], |
|
373 | - 'foes' => ['c'], |
|
370 | + 'id' => 'b', |
|
371 | + 'name' => 'User B', |
|
372 | + 'friends' => ['a'], |
|
373 | + 'foes' => ['c'], |
|
374 | 374 | ], |
375 | - ] |
|
375 | + ] |
|
376 | 376 | )->shouldBeCalledTimes(1); |
377 | 377 | |
378 | 378 | $database->query(['a', 'b', 'c', 'd', 'e'])->willReturn( |
379 | - [ |
|
379 | + [ |
|
380 | 380 | 'a' => ['id' => 'a', 'name' => 'User A'], |
381 | 381 | 'b' => ['id' => 'b', 'name' => 'User B'], |
382 | 382 | 'c' => ['id' => 'c', 'name' => 'User C'], |
383 | 383 | 'd' => ['id' => 'd', 'name' => 'User D'], |
384 | 384 | 'e' => ['id' => 'e', 'name' => 'User E'], |
385 | - ] |
|
385 | + ] |
|
386 | 386 | )->shouldBeCalledTimes(1); |
387 | 387 | |
388 | 388 | $result = $this->query( |
389 | - $query, |
|
390 | - new DeferredQueryBuffer($database->reveal()) |
|
389 | + $query, |
|
390 | + new DeferredQueryBuffer($database->reveal()) |
|
391 | 391 | ); |
392 | 392 | |
393 | 393 | $database->checkProphecyMethodsPredictions(); |
394 | 394 | |
395 | 395 | $this->assertEquals( |
396 | - [ |
|
396 | + [ |
|
397 | 397 | 'a' => [ |
398 | - [ |
|
398 | + [ |
|
399 | 399 | 'name' => 'User A', |
400 | 400 | 'friends' => [ |
401 | - ['name' => 'User B'], |
|
402 | - ['name' => 'User C'], |
|
401 | + ['name' => 'User B'], |
|
402 | + ['name' => 'User C'], |
|
403 | 403 | ], |
404 | 404 | 'foes' => [ |
405 | - ['name' => 'User D'], |
|
406 | - ['name' => 'User E'], |
|
405 | + ['name' => 'User D'], |
|
406 | + ['name' => 'User E'], |
|
407 | + ], |
|
407 | 408 | ], |
408 | - ], |
|
409 | 409 | ], |
410 | 410 | 'b' => [ |
411 | - [ |
|
411 | + [ |
|
412 | 412 | 'name' => 'User B', |
413 | 413 | 'friends' => [ |
414 | - ['name' => 'User A'], |
|
414 | + ['name' => 'User A'], |
|
415 | 415 | ], |
416 | 416 | 'foes' => [ |
417 | - ['name' => 'User C'], |
|
417 | + ['name' => 'User C'], |
|
418 | + ], |
|
418 | 419 | ], |
419 | - ], |
|
420 | 420 | ], |
421 | - ], |
|
422 | - $result['data'], |
|
423 | - 'Retrieved data is correct.' |
|
421 | + ], |
|
422 | + $result['data'], |
|
423 | + 'Retrieved data is correct.' |
|
424 | 424 | ); |
425 | 425 | } |
426 | 426 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * http://opensource.org/licenses/MIT |
10 | 10 | */ |
11 | 11 | |
12 | -declare(strict_types=1); |
|
12 | +declare(strict_types = 1); |
|
13 | 13 | /** |
14 | 14 | * This file is a part of GraphQL project. |
15 | 15 | */ |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $key = \md5(\serialize($ids)); |
65 | 65 | $this->buffer[$key] = $ids; |
66 | 66 | |
67 | - return function () use ($key) { |
|
67 | + return function() use ($key) { |
|
68 | 68 | return $this->fetch($key); |
69 | 69 | }; |
70 | 70 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | [ |
111 | 111 | 'name' => 'name', |
112 | 112 | 'type' => new StringType(), |
113 | - 'resolve' => static function ($value) { |
|
113 | + 'resolve' => static function($value) { |
|
114 | 114 | return $value['name']; |
115 | 115 | }, |
116 | 116 | ] |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | [ |
123 | 123 | 'name' => 'friends', |
124 | 124 | 'type' => new ListType(new self($this->database)), |
125 | - 'resolve' => function ($value) { |
|
125 | + 'resolve' => function($value) { |
|
126 | 126 | return new DeferredResolver( |
127 | 127 | $this->database->add($value['friends']) |
128 | 128 | ); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | [ |
137 | 137 | 'name' => 'foes', |
138 | 138 | 'type' => new ListType(new self($this->database)), |
139 | - 'resolve' => function ($value) { |
|
139 | + 'resolve' => function($value) { |
|
140 | 140 | return new DeferredResolver( |
141 | 141 | $this->database->add($value['foes']) |
142 | 142 | ); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | [ |
156 | 156 | 'name' => 'users', |
157 | 157 | 'type' => new ListType(new DeferredUserType($buffer)), |
158 | - 'resolve' => static function ($value, $args) use ($buffer) { |
|
158 | + 'resolve' => static function($value, $args) use ($buffer) { |
|
159 | 159 | return new DeferredResolver($buffer->add($args['ids'])); |
160 | 160 | }, |
161 | 161 | ] |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * http://opensource.org/licenses/MIT |
10 | 10 | */ |
11 | 11 | |
12 | -declare(strict_types=1); |
|
12 | +declare(strict_types = 1); |
|
13 | 13 | /** |
14 | 14 | * Date: 03.11.16. |
15 | 15 | */ |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | 'fields' => [ |
57 | 57 | 'nonNullScalar' => [ |
58 | 58 | 'type' => new NonNullType(new IntType()), |
59 | - 'resolve' => static function () { |
|
59 | + 'resolve' => static function() { |
|
60 | 60 | }, |
61 | 61 | ], |
62 | 62 | 'nonNullList' => [ |
63 | 63 | 'type' => new NonNullType(new ListType(new IntType())), |
64 | - 'resolve' => static function () { |
|
64 | + 'resolve' => static function() { |
|
65 | 65 | }, |
66 | 66 | ], |
67 | 67 | 'user' => [ |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | 'name' => new StringType(), |
73 | 73 | ], |
74 | 74 | ])), |
75 | - 'resolve' => static function () { |
|
75 | + 'resolve' => static function() { |
|
76 | 76 | return [ |
77 | 77 | 'id' => new uid('6cfb044c-9c0a-4ddd-9ef8-a0b940818db3'), |
78 | 78 | 'name' => 'Alex', |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | ], |
82 | 82 | 'nonNullListOfNpnNull' => [ |
83 | 83 | 'type' => new NonNullType(new ListType(new NonNullType(new IntType()))), |
84 | - 'resolve' => static function () { |
|
84 | + 'resolve' => static function() { |
|
85 | 85 | return [1, null]; |
86 | 86 | }, |
87 | 87 | ], |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | 'ids' => new NonNullType(new ListType(new IntType())), |
91 | 91 | ], |
92 | 92 | 'type' => new IntType(), |
93 | - 'resolve' => static function () { |
|
93 | + 'resolve' => static function() { |
|
94 | 94 | return 1; |
95 | 95 | }, |
96 | 96 | ], |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | 'ids' => new NonNullType(new ListType(new NonNullType(new IntType()))), |
100 | 100 | ], |
101 | 101 | 'type' => new IntType(), |
102 | - 'resolve' => static function () { |
|
102 | + 'resolve' => static function() { |
|
103 | 103 | return 1; |
104 | 104 | }, |
105 | 105 | ], |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * http://opensource.org/licenses/MIT |
10 | 10 | */ |
11 | 11 | |
12 | -declare(strict_types=1); |
|
12 | +declare(strict_types = 1); |
|
13 | 13 | /* |
14 | 14 | * This file is a part of GraphQL project. |
15 | 15 | * |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * http://opensource.org/licenses/MIT |
10 | 10 | */ |
11 | 11 | |
12 | -declare(strict_types=1); |
|
12 | +declare(strict_types = 1); |
|
13 | 13 | |
14 | 14 | namespace Youshido\Tests\Schema; |
15 | 15 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | 'fields' => [ |
106 | 106 | 'user' => [ |
107 | 107 | 'type' => new UserType(), |
108 | - 'resolve' => static function ($args) { |
|
108 | + 'resolve' => static function($args) { |
|
109 | 109 | return [ |
110 | 110 | 'id' => 'user-id-1', |
111 | 111 | 'fullName' => 'Alex', |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | 'fields' => [ |
220 | 220 | 'user' => [ |
221 | 221 | 'type' => new UserType(), |
222 | - 'resolve' => static function ($args) { |
|
222 | + 'resolve' => static function($args) { |
|
223 | 223 | return [ |
224 | 224 | 'id' => 'user-id-1', |
225 | 225 | 'fullName' => 'Alex', |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * http://opensource.org/licenses/MIT |
10 | 10 | */ |
11 | 11 | |
12 | -declare(strict_types=1); |
|
12 | +declare(strict_types = 1); |
|
13 | 13 | /* |
14 | 14 | * This file is a part of GraphQL project. |
15 | 15 | * |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $this->assertEquals(1, \count($schema->getMutationType()->getFields())); |
47 | 47 | |
48 | - $schema->addMutationField('changeUser', ['type' => new TestObjectType(), 'resolve' => static function (): void { |
|
48 | + $schema->addMutationField('changeUser', ['type' => new TestObjectType(), 'resolve' => static function(): void { |
|
49 | 49 | }]); |
50 | 50 | $this->assertEquals(2, \count($schema->getMutationType()->getFields())); |
51 | 51 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | 'fields' => [ |
77 | 77 | 'name' => new StringType(), |
78 | 78 | ], |
79 | - 'resolveType' => static function () use ($authorType) { |
|
79 | + 'resolveType' => static function() use ($authorType) { |
|
80 | 80 | return $authorType; |
81 | 81 | }, |
82 | 82 | ]); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'fields' => [ |
96 | 96 | 'user' => [ |
97 | 97 | 'type' => $userInterface, |
98 | - 'resolve' => static function () { |
|
98 | + 'resolve' => static function() { |
|
99 | 99 | return [ |
100 | 100 | 'name' => 'Alex', |
101 | 101 | ]; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * http://opensource.org/licenses/MIT |
10 | 10 | */ |
11 | 11 | |
12 | -declare(strict_types=1); |
|
12 | +declare(strict_types = 1); |
|
13 | 13 | |
14 | 14 | namespace Youshido\Tests\Schema; |
15 | 15 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | ], |
58 | 58 | ]), |
59 | 59 | ], |
60 | - 'resolve' => static function ($source, $args) { |
|
60 | + 'resolve' => static function($source, $args) { |
|
61 | 61 | return \sprintf( |
62 | 62 | 'Result with level %s and status %s', |
63 | 63 | $args['statObject']['level'], |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | 'status' => $enumType, |
73 | 73 | ], |
74 | 74 | ]), |
75 | - 'resolve' => static function () { |
|
75 | + 'resolve' => static function() { |
|
76 | 76 | return [ |
77 | 77 | 'status' => null, |
78 | 78 | ]; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * http://opensource.org/licenses/MIT |
10 | 10 | */ |
11 | 11 | |
12 | -declare(strict_types=1); |
|
12 | +declare(strict_types = 1); |
|
13 | 13 | /* |
14 | 14 | * This file is a part of GraphQL project. |
15 | 15 | * |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | 'fields' => [ |
117 | 117 | 'list' => [ |
118 | 118 | 'type' => new ListType(new StringType()), |
119 | - 'resolve' => static function () { |
|
119 | + 'resolve' => static function() { |
|
120 | 120 | }, |
121 | 121 | ], |
122 | 122 | ], |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | 'fields' => [ |
135 | 135 | 'list' => [ |
136 | 136 | 'type' => new ListType(new StringType()), |
137 | - 'resolve' => static function () { |
|
137 | + 'resolve' => static function() { |
|
138 | 138 | }, |
139 | 139 | ], |
140 | 140 | ], |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | 'args' => [ |
160 | 160 | 'shorten' => new BooleanType(), |
161 | 161 | ], |
162 | - 'resolve' => static function ($value, $args) { |
|
162 | + 'resolve' => static function($value, $args) { |
|
163 | 163 | return empty($args['shorten']) ? $value['firstName'] : $value['firstName']; |
164 | 164 | }, |
165 | 165 | ], |
166 | 166 | 'id_alias' => [ |
167 | 167 | 'type' => new IdType(), |
168 | - 'resolve' => static function ($value) { |
|
168 | + 'resolve' => static function($value) { |
|
169 | 169 | return $value['id']; |
170 | 170 | }, |
171 | 171 | ], |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | 'code' => new StringType(), |
174 | 174 | ], |
175 | 175 | ]), |
176 | - 'resolve' => static function ($value, $args) { |
|
176 | + 'resolve' => static function($value, $args) { |
|
177 | 177 | $data = ['id' => '123', 'firstName' => 'John', 'code' => '007']; |
178 | 178 | |
179 | 179 | if (!empty($args['upper'])) { |
@@ -193,19 +193,19 @@ discard block |
||
193 | 193 | ], |
194 | 194 | 'randomUser' => [ |
195 | 195 | 'type' => new TestObjectType(), |
196 | - 'resolve' => static function () { |
|
196 | + 'resolve' => static function() { |
|
197 | 197 | return ['invalidField' => 'John']; |
198 | 198 | }, |
199 | 199 | ], |
200 | 200 | 'invalidValueQuery' => [ |
201 | 201 | 'type' => new TestObjectType(), |
202 | - 'resolve' => static function () { |
|
202 | + 'resolve' => static function() { |
|
203 | 203 | return 'stringValue'; |
204 | 204 | }, |
205 | 205 | ], |
206 | 206 | 'labels' => [ |
207 | 207 | 'type' => new ListType(new StringType()), |
208 | - 'resolve' => static function () { |
|
208 | + 'resolve' => static function() { |
|
209 | 209 | return ['one', 'two']; |
210 | 210 | }, |
211 | 211 | ], |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | ->addField(new Field([ |
243 | 243 | 'name' => 'increaseCounter', |
244 | 244 | 'type' => new IntType(), |
245 | - 'resolve' => function ($value, $args, ResolveInfo $info) { |
|
245 | + 'resolve' => function($value, $args, ResolveInfo $info) { |
|
246 | 246 | return $this->_counter += $args['amount']; |
247 | 247 | }, |
248 | 248 | 'args' => [ |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | ]))->addField(new Field([ |
255 | 255 | 'name' => 'invalidResolveTypeMutation', |
256 | 256 | 'type' => new NonNullType(new IntType()), |
257 | - 'resolve' => static function () { |
|
257 | + 'resolve' => static function() { |
|
258 | 258 | }, |
259 | 259 | ]))->addField(new Field([ |
260 | 260 | 'name' => 'interfacedMutation', |
261 | 261 | 'type' => new TestInterfaceType(), |
262 | - 'resolve' => static function () { |
|
262 | + 'resolve' => static function() { |
|
263 | 263 | return ['name' => 'John']; |
264 | 264 | }, |
265 | 265 | ])); |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | ])), |
389 | 389 | ], |
390 | 390 | 'type' => new StringType(), |
391 | - 'resolve' => static function ($value, $args) { |
|
391 | + 'resolve' => static function($value, $args) { |
|
392 | 392 | return $args['argument1']; |
393 | 393 | }, |
394 | 394 | ], |
@@ -441,42 +441,42 @@ discard block |
||
441 | 441 | 'fields' => [ |
442 | 442 | 'listQuery' => [ |
443 | 443 | 'type' => new ListType(new TestEnumType()), |
444 | - 'resolve' => static function () { |
|
444 | + 'resolve' => static function() { |
|
445 | 445 | return 'invalid list'; |
446 | 446 | }, |
447 | 447 | ], |
448 | 448 | 'listEnumQuery' => [ |
449 | 449 | 'type' => new ListType(new TestEnumType()), |
450 | - 'resolve' => static function () { |
|
450 | + 'resolve' => static function() { |
|
451 | 451 | return ['invalid enum']; |
452 | 452 | }, |
453 | 453 | ], |
454 | 454 | 'invalidEnumQuery' => [ |
455 | 455 | 'type' => new TestEnumType(), |
456 | - 'resolve' => static function () { |
|
456 | + 'resolve' => static function() { |
|
457 | 457 | return 'invalid enum'; |
458 | 458 | }, |
459 | 459 | ], |
460 | 460 | 'enumQuery' => [ |
461 | 461 | 'type' => new TestEnumType(), |
462 | - 'resolve' => static function () { |
|
462 | + 'resolve' => static function() { |
|
463 | 463 | return 1; |
464 | 464 | }, |
465 | 465 | ], |
466 | 466 | 'invalidNonNullQuery' => [ |
467 | 467 | 'type' => new NonNullType(new IntType()), |
468 | - 'resolve' => static function () { |
|
468 | + 'resolve' => static function() { |
|
469 | 469 | }, |
470 | 470 | ], |
471 | 471 | 'invalidNonNullInsideQuery' => [ |
472 | 472 | 'type' => new NonNullType(new IntType()), |
473 | - 'resolve' => static function () { |
|
473 | + 'resolve' => static function() { |
|
474 | 474 | return 'hello'; |
475 | 475 | }, |
476 | 476 | ], |
477 | 477 | 'objectQuery' => [ |
478 | 478 | 'type' => new TestObjectType(), |
479 | - 'resolve' => static function () { |
|
479 | + 'resolve' => static function() { |
|
480 | 480 | return ['name' => 'John']; |
481 | 481 | }, |
482 | 482 | ], |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | 'enum' => new TestEnumType(), |
489 | 489 | ], |
490 | 490 | ]), |
491 | - 'resolve' => static function () { |
|
491 | + 'resolve' => static function() { |
|
492 | 492 | return [ |
493 | 493 | 'object' => [ |
494 | 494 | 'name' => 'John', |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | $union = new UnionType([ |
570 | 570 | 'name' => 'TestUnion', |
571 | 571 | 'types' => [$object1, $object2], |
572 | - 'resolveType' => static function ($object) use ($object1, $object2) { |
|
572 | + 'resolveType' => static function($object) use ($object1, $object2) { |
|
573 | 573 | if (isset($object['id'])) { |
574 | 574 | return $object1; |
575 | 575 | } |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | $invalidUnion = new UnionType([ |
581 | 581 | 'name' => 'TestUnion', |
582 | 582 | 'types' => [$object1, $object2], |
583 | - 'resolveType' => static function ($object) use ($object3) { |
|
583 | + 'resolveType' => static function($object) use ($object3) { |
|
584 | 584 | return $object3; |
585 | 585 | }, |
586 | 586 | ]); |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | 'type' => ['type' => 'string'], |
595 | 595 | ], |
596 | 596 | 'cost' => 10, |
597 | - 'resolve' => static function ($value, $args) { |
|
597 | + 'resolve' => static function($value, $args) { |
|
598 | 598 | if ('object1' === $args['type']) { |
599 | 599 | return [ |
600 | 600 | 'id' => 43, |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | ], |
609 | 609 | 'invalidUnion' => [ |
610 | 610 | 'type' => $invalidUnion, |
611 | - 'resolve' => static function () { |
|
611 | + 'resolve' => static function() { |
|
612 | 612 | return ['name' => 'name resolved']; |
613 | 613 | }, |
614 | 614 | ], |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | 'fields' => [ |
679 | 679 | 'currentUser' => [ |
680 | 680 | 'type' => new StringType(), |
681 | - 'resolve' => static function ($source, $args, ResolveInfo $info) { |
|
681 | + 'resolve' => static function($source, $args, ResolveInfo $info) { |
|
682 | 682 | return $info->getContainer()->get('user')['name']; |
683 | 683 | }, |
684 | 684 | ], |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | 'args' => [ |
713 | 713 | 'shorten' => new BooleanType(), |
714 | 714 | ], |
715 | - 'resolve' => static function ($value, $args) { |
|
715 | + 'resolve' => static function($value, $args) { |
|
716 | 716 | return empty($args['shorten']) ? $value['firstName'] : $value['firstName']; |
717 | 717 | }, |
718 | 718 | ], |
@@ -721,19 +721,19 @@ discard block |
||
721 | 721 | 'likes' => [ |
722 | 722 | 'type' => new IntType(), |
723 | 723 | 'cost' => 10, |
724 | - 'resolve' => static function () { |
|
724 | + 'resolve' => static function() { |
|
725 | 725 | return 42; |
726 | 726 | }, |
727 | 727 | ], |
728 | 728 | ], |
729 | 729 | ] |
730 | 730 | ), |
731 | - 'cost' => static function ($args, $context, $childCost) { |
|
731 | + 'cost' => static function($args, $context, $childCost) { |
|
732 | 732 | $argsCost = $args['cost'] ?? 1; |
733 | 733 | |
734 | 734 | return 1 + $argsCost * $childCost; |
735 | 735 | }, |
736 | - 'resolve' => static function ($value, $args) { |
|
736 | + 'resolve' => static function($value, $args) { |
|
737 | 737 | $data = ['firstName' => 'John', 'code' => '007']; |
738 | 738 | |
739 | 739 | return $data; |