Completed
Push — master ( 911cdf...67ba27 )
by Alexandr
02:54
created
Tests/Parser/AstTest.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function testArgument()
27 27
     {
28
-        $argument = new Argument('test', new Literal('test', new Location(1,1)), new Location(1,1));
28
+        $argument = new Argument('test', new Literal('test', new Location(1, 1)), new Location(1, 1));
29 29
 
30 30
         $this->assertNotNull($argument->getValue());
31 31
         $this->assertEquals($argument->getName(), 'test');
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function testField()
41 41
     {
42
-        $field = new Field('field', null, [], [], new Location(1,1));
42
+        $field = new Field('field', null, [], [], new Location(1, 1));
43 43
 
44 44
         $this->assertEquals($field->getName(), 'field');
45 45
         $this->assertEmpty($field->getArguments());
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $this->assertEquals($field->getAlias(), 'alias');
51 51
         $this->assertEquals($field->getName(), 'alias');
52 52
 
53
-        $field->addArgument(new Argument('argument', new Literal('argument value', new Location(1,1)), new Location(1,1)));
53
+        $field->addArgument(new Argument('argument', new Literal('argument value', new Location(1, 1)), new Location(1, 1)));
54 54
         $this->assertTrue($field->hasArguments());
55 55
         $this->assertEquals(['argument' => 'argument value'], $field->getKeyValueArguments());
56 56
     }
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
     public function testFragment()
59 59
     {
60 60
         $fields = [
61
-            new Field('field', null, [], [], new Location(1,1))
61
+            new Field('field', null, [], [], new Location(1, 1))
62 62
         ];
63 63
 
64
-        $fragment = new Fragment('shipInfo', 'Ship', [], $fields, new Location(1,1));
64
+        $fragment = new Fragment('shipInfo', 'Ship', [], $fields, new Location(1, 1));
65 65
 
66 66
         $this->assertEquals('shipInfo', $fragment->getName());
67 67
         $this->assertEquals('Ship', $fragment->getModel());
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $this->assertEquals('Boat', $fragment->getModel());
75 75
 
76 76
         $newField = [
77
-            new Field('id', null, [], [], new Location(1,1))
77
+            new Field('id', null, [], [], new Location(1, 1))
78 78
         ];
79 79
         $fragment->setFields($newField);
80 80
         $this->assertEquals($newField, $fragment->getFields());
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
     public function testFragmentReference()
88 88
     {
89
-        $reference = new FragmentReference('shipInfo', new Location(1,1));
89
+        $reference = new FragmentReference('shipInfo', new Location(1, 1));
90 90
 
91 91
         $this->assertEquals('shipInfo', $reference->getName());
92 92
 
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
     public function testTypedFragmentReference()
98 98
     {
99 99
         $fields = [
100
-            new Field('id', null, [], [], new Location(1,1))
100
+            new Field('id', null, [], [], new Location(1, 1))
101 101
         ];
102 102
 
103
-        $reference = new TypedFragmentReference('Ship', $fields, [], new Location(1,1));
103
+        $reference = new TypedFragmentReference('Ship', $fields, [], new Location(1, 1));
104 104
 
105 105
         $this->assertEquals('Ship', $reference->getTypeName());
106 106
         $this->assertEquals($fields, $reference->getFields());
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
         $this->assertEquals('BigBoat', $reference->getTypeName());
110 110
 
111 111
         $newFields = [
112
-            new Field('name', null, [], [], new Location(1,1)),
113
-            new Field('id', null, [], [], new Location(1,1))
112
+            new Field('name', null, [], [], new Location(1, 1)),
113
+            new Field('id', null, [], [], new Location(1, 1))
114 114
         ];
115 115
 
116 116
         $reference->setFields($newFields);
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
     public function testQuery()
121 121
     {
122 122
         $arguments = [
123
-            new Argument('limit', new Literal('10', new Location(1,1)), new Location(1,1))
123
+            new Argument('limit', new Literal('10', new Location(1, 1)), new Location(1, 1))
124 124
         ];
125 125
 
126 126
         $fields = [
127
-            new Field('id', null, [], [], new Location(1,1))
127
+            new Field('id', null, [], [], new Location(1, 1))
128 128
         ];
129 129
 
130
-        $query = new Query('ships', 'lastShips', $arguments, $fields,[], new Location(1,1));
130
+        $query = new Query('ships', 'lastShips', $arguments, $fields, [], new Location(1, 1));
131 131
 
132 132
         $this->assertEquals('ships', $query->getName());
133 133
         $this->assertEquals('lastShips', $query->getAlias());
@@ -147,23 +147,23 @@  discard block
 block discarded – undo
147 147
         $this->assertFalse($query->hasArguments());
148 148
         $this->assertFalse($query->hasFields());
149 149
 
150
-        $query->addArgument(new Argument('offset', new Literal(10, new Location(1,1)), new Location(1,1)));
150
+        $query->addArgument(new Argument('offset', new Literal(10, new Location(1, 1)), new Location(1, 1)));
151 151
         $this->assertTrue($query->hasArguments());
152 152
     }
153 153
 
154 154
     public function testArgumentValues()
155 155
     {
156
-        $list = new InputList(['a', 'b'], new Location(1,1));
156
+        $list = new InputList(['a', 'b'], new Location(1, 1));
157 157
         $this->assertEquals(['a', 'b'], $list->getValue());
158 158
         $list->setValue(['a']);
159 159
         $this->assertEquals(['a'], $list->getValue());
160 160
 
161
-        $inputObject = new InputObject(['a', 'b'], new Location(1,1));
161
+        $inputObject = new InputObject(['a', 'b'], new Location(1, 1));
162 162
         $this->assertEquals(['a', 'b'], $inputObject->getValue());
163 163
         $inputObject->setValue(['a']);
164 164
         $this->assertEquals(['a'], $inputObject->getValue());
165 165
 
166
-        $literal = new Literal('text', new Location(1,1));
166
+        $literal = new Literal('text', new Location(1, 1));
167 167
         $this->assertEquals('text', $literal->getValue());
168 168
         $literal->setValue('new text');
169 169
         $this->assertEquals('new text', $literal->getValue());
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
     public function testVariable()
173 173
     {
174
-        $variable = new Variable('id', 'int', false, false, true, new Location(1,1));
174
+        $variable = new Variable('id', 'int', false, false, true, new Location(1, 1));
175 175
 
176 176
         $this->assertEquals('id', $variable->getName());
177 177
         $this->assertEquals('int', $variable->getTypeName());
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
         $this->assertTrue($variable->isNullable());
191 191
         $this->assertTrue($variable->isArray());
192 192
 
193
-        $variable->setValue(new Literal('text', new Location(1,1)));
194
-        $this->assertEquals(new Literal('text', new Location(1,1)), $variable->getValue());
193
+        $variable->setValue(new Literal('text', new Location(1, 1)));
194
+        $this->assertEquals(new Literal('text', new Location(1, 1)), $variable->getValue());
195 195
     }
196 196
 
197 197
     /**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      */
200 200
     public function testVariableLogicException()
201 201
     {
202
-        $variable = new Variable('id', 'int', false, false, true, new Location(1,1));
202
+        $variable = new Variable('id', 'int', false, false, true, new Location(1, 1));
203 203
         $variable->getValue();
204 204
     }
205 205
 }
Please login to merge, or discard this patch.
Tests/Parser/RequestTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 
19 19
     public function testMethods()
20 20
     {
21
-        $fragment1     = new Fragment('fragmentName1', 'test', [], [], new Location(1,1));
22
-        $fragment2     = new Fragment('fragmentName2', 'test', [], [], new Location(1,1));
21
+        $fragment1     = new Fragment('fragmentName1', 'test', [], [], new Location(1, 1));
22
+        $fragment2     = new Fragment('fragmentName2', 'test', [], [], new Location(1, 1));
23 23
         $queriesData   = ['query1', 'query2'];
24 24
         $mutationsData = ['mutation1', 'mutation2'];
25 25
         $fragmentsData = [$fragment1];
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     public function testSetVariableParseJson()
55 55
     {
56 56
         $variables = '{"foo": "bar"}';
57
-        $expectedVariableArray = [ 'foo' => 'bar' ];
57
+        $expectedVariableArray = ['foo' => 'bar'];
58 58
 
59 59
         $request = new Request([], $variables);
60 60
         $this->assertEquals($expectedVariableArray, $request->getVariables());
Please login to merge, or discard this patch.
Tests/Parser/VariableTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      */
15 15
     public function testGetValue($actual, $expected)
16 16
     {
17
-        $var = new Variable('foo', 'bar', false, false, true, new Location(1,1));
17
+        $var = new Variable('foo', 'bar', false, false, true, new Location(1, 1));
18 18
         $var->setValue($actual);
19 19
         $this->assertEquals($var->getValue(), $expected);
20 20
     }
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function testGetNullValueException()
27 27
     {
28
-        $var = new Variable('foo', 'bar', false, false, true, new Location(1,1));
28
+        $var = new Variable('foo', 'bar', false, false, true, new Location(1, 1));
29 29
         $var->getValue();
30 30
     }
31 31
 
32 32
     public function testGetValueReturnsDefaultValueIfNoValueSet()
33 33
     {
34
-        $var = new Variable('foo', 'bar', false, false, true, new Location(1,1));
34
+        $var = new Variable('foo', 'bar', false, false, true, new Location(1, 1));
35 35
         $var->setDefaultValue('default-value');
36 36
 
37 37
         $this->assertEquals(
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function testGetValueReturnsSetValueEvenWithDefaultValue()
44 44
     {
45
-        $var = new Variable('foo', 'bar', false, false, true, new Location(1,1));
45
+        $var = new Variable('foo', 'bar', false, false, true, new Location(1, 1));
46 46
         $var->setValue('real-value');
47 47
         $var->setDefaultValue('default-value');
48 48
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function testIndicatesDefaultValuePresent()
56 56
     {
57
-        $var = new Variable('foo', 'bar', false, false, true, new Location(1,1));
57
+        $var = new Variable('foo', 'bar', false, false, true, new Location(1, 1));
58 58
         $var->setDefaultValue('default-value');
59 59
 
60 60
         $this->assertTrue(
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
     public function testHasNoDefaultValue()
66 66
     {
67
-        $var = new Variable('foo', 'bar', false, false, true, new Location(1,1));
67
+        $var = new Variable('foo', 'bar', false, false, true, new Location(1, 1));
68 68
 
69 69
         $this->assertFalse(
70 70
             $var->hasDefaultValue()
Please login to merge, or discard this patch.
src/Execution/Processor.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -149,6 +149,9 @@  discard block
 block discarded – undo
149 149
         return [$this->getAlias($query) => $value];
150 150
     }
151 151
 
152
+    /**
153
+     * @return AstFieldInterface
154
+     */
152 155
     protected function resolveField(FieldInterface $field, AstFieldInterface $ast, $parentValue = null, $fromObject = false)
153 156
     {
154 157
         try {
@@ -220,6 +223,9 @@  discard block
 block discarded – undo
220 223
         }
221 224
     }
222 225
 
226
+    /**
227
+     * @param \Youshido\GraphQL\Parser\Ast\Interfaces\ValueInterface $argumentValue
228
+     */
223 229
     private function prepareArgumentValue($argumentValue, AbstractType $argumentType, Request $request)
224 230
     {
225 231
         switch ($argumentType->getKind()) {
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 
94 94
             // If the processor found any deferred results, resolve them now.
95 95
             if (!empty($this->data) && $this->deferredResults) {
96
-              try {
97
-                  while ($deferredResolver = array_shift($this->deferredResults)) {
98
-                      $deferredResolver->resolve();
99
-                  }
100
-              } catch (\Exception $e) {
101
-                  $this->executionContext->addError($e);
102
-              } finally {
103
-                  $this->data = static::unpackDeferredResults($this->data);
104
-              }
96
+                try {
97
+                    while ($deferredResolver = array_shift($this->deferredResults)) {
98
+                        $deferredResolver->resolve();
99
+                    }
100
+                } catch (\Exception $e) {
101
+                    $this->executionContext->addError($e);
102
+                } finally {
103
+                    $this->data = static::unpackDeferredResults($this->data);
104
+                }
105 105
             }
106 106
 
107 107
         } catch (\Exception $e) {
@@ -429,9 +429,9 @@  discard block
 block discarded – undo
429 429
             }
430 430
 
431 431
             $fakeField = new Field([
432
-              'name' => $field->getName(),
433
-              'type' => $itemType,
434
-              'args' => $field->getArguments(),
432
+                'name' => $field->getName(),
433
+                'type' => $itemType,
434
+                'args' => $field->getArguments(),
435 435
             ]);
436 436
 
437 437
             $result = [];
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
             }
527 527
 
528 528
             $fakeField = new Field([
529
-              'name' => $field->getName(),
530
-              'type' => $resolvedType,
531
-              'args' => $field->getArguments(),
529
+                'name' => $field->getName(),
530
+                'type' => $resolvedType,
531
+                'args' => $field->getArguments(),
532 532
             ]);
533 533
 
534 534
             return $this->resolveObject($fakeField, $ast, $resolvedValue, true);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
         /** @var AstQuery $ast */
413 413
         $resolvedValue = $this->doResolve($field, $ast, $parentValue);
414 414
 
415
-        return $this->deferredResolve($resolvedValue, function ($resolvedValue) use ($field, $ast, $parentValue) {
415
+        return $this->deferredResolve($resolvedValue, function($resolvedValue) use ($field, $ast, $parentValue) {
416 416
             $this->resolveValidator->assertValidResolvedValueForField($field, $resolvedValue);
417 417
 
418 418
             if (null === $resolvedValue) {
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
             $result = [];
438 438
             foreach ($resolvedValue as $resolvedValueItem) {
439 439
                 try {
440
-                    $fakeField->getConfig()->set('resolve', function () use ($resolvedValueItem) {
440
+                    $fakeField->getConfig()->set('resolve', function() use ($resolvedValueItem) {
441 441
                         return $resolvedValueItem;
442 442
                     });
443 443
 
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
             $resolvedValue = $this->doResolve($field, $ast, $parentValue);
484 484
         }
485 485
 
486
-        return $this->deferredResolve($resolvedValue, function ($resolvedValue) use ($field, $ast, $parentValue) {
486
+        return $this->deferredResolve($resolvedValue, function($resolvedValue) use ($field, $ast, $parentValue) {
487 487
             $this->resolveValidator->assertValidResolvedValueForField($field, $resolvedValue);
488 488
 
489 489
             if (null === $resolvedValue) {
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
     {
505 505
         /** @var AstQuery $ast */
506 506
         $resolvedValue = $this->doResolve($field, $ast, $parentValue);
507
-        return $this->deferredResolve($resolvedValue, function ($resolvedValue) use ($field, $ast, $parentValue) {
507
+        return $this->deferredResolve($resolvedValue, function($resolvedValue) use ($field, $ast, $parentValue) {
508 508
             $this->resolveValidator->assertValidResolvedValueForField($field, $resolvedValue);
509 509
 
510 510
             if (null === $resolvedValue) {
Please login to merge, or discard this patch.
examples/04_bookstore/schema-bootstrap.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (is_file(__DIR__ . '/../../../../../vendor/autoload.php')) {
4
-    require_once __DIR__ . '/../../../../../vendor/autoload.php';
3
+if (is_file(__DIR__.'/../../../../../vendor/autoload.php')) {
4
+    require_once __DIR__.'/../../../../../vendor/autoload.php';
5 5
 }
6
-require_once __DIR__ . '/../../vendor/autoload.php';
7
-require_once __DIR__ . '/Schema/Type/BookType.php';
8
-require_once __DIR__ . '/Schema/Type/AuthorType.php';
9
-require_once __DIR__ . '/Schema/Type/CategoryType.php';
10
-require_once __DIR__ . '/Schema/Field/Book/RecentBooksField.php';
11
-require_once __DIR__ . '/Schema/Field/CategoriesField.php';
12
-require_once __DIR__ . '/DataProvider.php';
13
-require_once __DIR__ . '/Schema/BookStoreSchema.php';
6
+require_once __DIR__.'/../../vendor/autoload.php';
7
+require_once __DIR__.'/Schema/Type/BookType.php';
8
+require_once __DIR__.'/Schema/Type/AuthorType.php';
9
+require_once __DIR__.'/Schema/Type/CategoryType.php';
10
+require_once __DIR__.'/Schema/Field/Book/RecentBooksField.php';
11
+require_once __DIR__.'/Schema/Field/CategoriesField.php';
12
+require_once __DIR__.'/DataProvider.php';
13
+require_once __DIR__.'/Schema/BookStoreSchema.php';
Please login to merge, or discard this patch.
examples/04_bookstore/Schema/Field/CategoriesField.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
24 24
 
25 25
     public function resolve($value, array $args, ResolveInfo $info)
26 26
     {
27
-        return new DeferredResolver(function () use ($value) {
28
-            $id = empty($value['id']) ? "1" : $value['id'] . ".1";
27
+        return new DeferredResolver(function() use ($value) {
28
+            $id = empty($value['id']) ? "1" : $value['id'].".1";
29 29
 
30 30
             return [
31 31
                 'id'       => $id,
32
-                'title'    => 'Category ' . $id,
32
+                'title'    => 'Category '.$id,
33 33
                 'authors'  => [
34 34
                     [
35 35
                         'id'        => 'author1',
Please login to merge, or discard this patch.
examples/04_bookstore/Schema/BookStoreSchema.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
         $config->getQuery()->addFields([
25 25
             'authors' => [
26 26
                 'type'    => new ListType(new AuthorType()),
27
-                'resolve' => function () {
27
+                'resolve' => function() {
28 28
                     return DataProvider::getAuthors();
29 29
                 }
30 30
             ],
Please login to merge, or discard this patch.
Tests/Schema/DeferredTest.php 2 patches
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         if (!array_key_exists($resultId, $this->results)) {
69 69
             $query = array_unique(
70
-              array_reduce($this->buffer, 'array_merge', [])
70
+                array_reduce($this->buffer, 'array_merge', [])
71 71
             );
72 72
             sort($query);
73 73
             $result = $this->database->query($query);
@@ -101,43 +101,43 @@  discard block
 block discarded – undo
101 101
     public function build($config)
102 102
     {
103 103
         $config->addField(
104
-          new Field(
104
+            new Field(
105 105
             [
106
-              'name' => 'name',
107
-              'type' => new StringType(),
108
-              'resolve' => function ($value) {
109
-                  return $value['name'];
110
-              },
106
+                'name' => 'name',
107
+                'type' => new StringType(),
108
+                'resolve' => function ($value) {
109
+                    return $value['name'];
110
+                },
111 111
             ]
112
-          )
112
+            )
113 113
         );
114 114
 
115 115
         $config->addField(
116
-          new Field(
116
+            new Field(
117 117
             [
118
-              'name' => 'friends',
119
-              'type' => new ListType(new DeferredUserType($this->database)),
120
-              'resolve' => function ($value) {
121
-                  return new DeferredResolver(
118
+                'name' => 'friends',
119
+                'type' => new ListType(new DeferredUserType($this->database)),
120
+                'resolve' => function ($value) {
121
+                    return new DeferredResolver(
122 122
                     $this->database->add($value['friends'])
123
-                  );
124
-              },
123
+                    );
124
+                },
125 125
             ]
126
-          )
126
+            )
127 127
         );
128 128
 
129 129
         $config->addField(
130
-          new Field(
130
+            new Field(
131 131
             [
132
-              'name' => 'foes',
133
-              'type' => new ListType(new DeferredUserType($this->database)),
134
-              'resolve' => function ($value) {
135
-                  return new DeferredResolver(
132
+                'name' => 'foes',
133
+                'type' => new ListType(new DeferredUserType($this->database)),
134
+                'resolve' => function ($value) {
135
+                    return new DeferredResolver(
136 136
                     $this->database->add($value['foes'])
137
-                  );
138
-              },
137
+                    );
138
+                },
139 139
             ]
140
-          )
140
+            )
141 141
         );
142 142
     }
143 143
 }
@@ -148,30 +148,30 @@  discard block
 block discarded – undo
148 148
     public function __construct(DeferredQueryBuffer $buffer)
149 149
     {
150 150
         $usersField = new Field(
151
-          [
151
+            [
152 152
             'name' => 'users',
153 153
             'type' => new ListType(new DeferredUserType($buffer)),
154 154
             'resolve' => function ($value, $args) use ($buffer) {
155 155
                 return new DeferredResolver($buffer->add($args['ids']));
156 156
             },
157
-          ]
157
+            ]
158 158
         );
159 159
 
160 160
         $usersField->addArgument(
161
-          'ids',
162
-          [
161
+            'ids',
162
+            [
163 163
             'type' => new ListType(new StringType()),
164
-          ]
164
+            ]
165 165
         );
166 166
         parent::__construct(
167
-          [
167
+            [
168 168
             'query' => new ObjectType(
169
-              [
169
+                [
170 170
                 'name' => 'RootQuery',
171 171
                 'fields' => [$usersField],
172
-              ]
172
+                ]
173 173
             ),
174
-          ]
174
+            ]
175 175
         );
176 176
     }
177 177
 
@@ -216,28 +216,28 @@  discard block
 block discarded – undo
216 216
         $database = $this->prophesize(DeferredDatabase::class);
217 217
 
218 218
         $database->query(['a', 'b'])->willReturn(
219
-          [
219
+            [
220 220
             'a' => ['id' => 'a', 'name' => 'User A'],
221 221
             'b' => ['id' => 'b', 'name' => 'User B'],
222
-          ]
222
+            ]
223 223
         )->shouldBeCalledTimes(1);
224 224
 
225 225
         $result = $this->query(
226
-          $query,
227
-          new DeferredQueryBuffer($database->reveal())
226
+            $query,
227
+            new DeferredQueryBuffer($database->reveal())
228 228
         );
229 229
 
230 230
         $database->checkProphecyMethodsPredictions();
231 231
 
232 232
         $this->assertEquals(
233
-          [
233
+            [
234 234
             'users' => [
235
-              ['name' => 'User A'],
236
-              ['name' => 'User B'],
235
+                ['name' => 'User A'],
236
+                ['name' => 'User B'],
237
+            ],
237 238
             ],
238
-          ],
239
-          $result['data'],
240
-          'Retrieved correct data.'
239
+            $result['data'],
240
+            'Retrieved correct data.'
241 241
         );
242 242
     }
243 243
 
@@ -259,30 +259,30 @@  discard block
 block discarded – undo
259 259
         $database = $this->prophesize(DeferredDatabase::class);
260 260
 
261 261
         $database->query(['a', 'b'])->willReturn(
262
-          [
262
+            [
263 263
             'a' => ['id' => 'a', 'name' => 'User A'],
264 264
             'b' => ['id' => 'b', 'name' => 'User B'],
265
-          ]
265
+            ]
266 266
         )->shouldBeCalledTimes(1);
267 267
 
268 268
         $result = $this->query(
269
-          $query,
270
-          new DeferredQueryBuffer($database->reveal())
269
+            $query,
270
+            new DeferredQueryBuffer($database->reveal())
271 271
         );
272 272
 
273 273
         $database->checkProphecyMethodsPredictions();
274 274
 
275 275
         $this->assertEquals(
276
-          [
276
+            [
277 277
             'a' => [
278
-              ['name' => 'User A'],
278
+                ['name' => 'User A'],
279 279
             ],
280 280
             'b' => [
281
-              ['name' => 'User B'],
281
+                ['name' => 'User B'],
282
+            ],
282 283
             ],
283
-          ],
284
-          $result['data'],
285
-          'Retrieved correct data.'
284
+            $result['data'],
285
+            'Retrieved correct data.'
286 286
         );
287 287
 
288 288
     }
@@ -305,39 +305,39 @@  discard block
 block discarded – undo
305 305
         $database = $this->prophesize(DeferredDatabase::class);
306 306
 
307 307
         $database->query(['a'])->willReturn(
308
-          [
308
+            [
309 309
             'a' => ['id' => 'a', 'name' => 'User A', 'friends' => ['b', 'c']],
310
-          ]
310
+            ]
311 311
         )->shouldBeCalledTimes(1);
312 312
 
313 313
         $database->query(['b', 'c'])->willReturn(
314
-          [
314
+            [
315 315
             'b' => ['id' => 'b', 'name' => 'User B'],
316 316
             'c' => ['id' => 'c', 'name' => 'User C'],
317
-          ]
317
+            ]
318 318
         );
319 319
 
320 320
         $result = $this->query(
321
-          $query,
322
-          new DeferredQueryBuffer($database->reveal())
321
+            $query,
322
+            new DeferredQueryBuffer($database->reveal())
323 323
         );
324 324
 
325 325
         $database->checkProphecyMethodsPredictions();
326 326
 
327 327
         $this->assertEquals(
328
-          [
328
+            [
329 329
             'a' => [
330
-              [
330
+                [
331 331
                 'name' => 'User A',
332 332
                 'friends' => [
333
-                  ['name' => 'User B'],
334
-                  ['name' => 'User C'],
333
+                    ['name' => 'User B'],
334
+                    ['name' => 'User C'],
335
+                ],
335 336
                 ],
336
-              ],
337 337
             ],
338
-          ],
339
-          $result['data'],
340
-          'Retrieved correct data.'
338
+            ],
339
+            $result['data'],
340
+            'Retrieved correct data.'
341 341
         );
342 342
     }
343 343
 
@@ -371,68 +371,68 @@  discard block
 block discarded – undo
371 371
         $database = $this->prophesize(DeferredDatabase::class);
372 372
 
373 373
         $database->query(['a', 'b'])->willReturn(
374
-          [
374
+            [
375 375
             'a' => [
376
-              'id' => 'a',
377
-              'name' => 'User A',
378
-              'friends' => ['b', 'c'],
379
-              'foes' => ['d', 'e'],
376
+                'id' => 'a',
377
+                'name' => 'User A',
378
+                'friends' => ['b', 'c'],
379
+                'foes' => ['d', 'e'],
380 380
             ],
381 381
             'b' => [
382
-              'id' => 'b',
383
-              'name' => 'User B',
384
-              'friends' => ['a'],
385
-              'foes' => ['c'],
382
+                'id' => 'b',
383
+                'name' => 'User B',
384
+                'friends' => ['a'],
385
+                'foes' => ['c'],
386 386
             ],
387
-          ]
387
+            ]
388 388
         )->shouldBeCalledTimes(1);
389 389
 
390 390
         $database->query(['a', 'b', 'c', 'd', 'e'])->willReturn(
391
-          [
391
+            [
392 392
             'a' => ['id' => 'a', 'name' => 'User A'],
393 393
             'b' => ['id' => 'b', 'name' => 'User B'],
394 394
             'c' => ['id' => 'c', 'name' => 'User C'],
395 395
             'd' => ['id' => 'd', 'name' => 'User D'],
396 396
             'e' => ['id' => 'e', 'name' => 'User E'],
397
-          ]
397
+            ]
398 398
         )->shouldBeCalledTimes(1);
399 399
 
400 400
         $result = $this->query(
401
-          $query,
402
-          new DeferredQueryBuffer($database->reveal())
401
+            $query,
402
+            new DeferredQueryBuffer($database->reveal())
403 403
         );
404 404
 
405 405
         $database->checkProphecyMethodsPredictions();
406 406
 
407 407
         $this->assertEquals(
408
-          [
408
+            [
409 409
             'a' => [
410
-              [
410
+                [
411 411
                 'name' => 'User A',
412 412
                 'friends' => [
413
-                  ['name' => 'User B'],
414
-                  ['name' => 'User C'],
413
+                    ['name' => 'User B'],
414
+                    ['name' => 'User C'],
415 415
                 ],
416 416
                 'foes' => [
417
-                  ['name' => 'User D'],
418
-                  ['name' => 'User E'],
417
+                    ['name' => 'User D'],
418
+                    ['name' => 'User E'],
419
+                ],
419 420
                 ],
420
-              ],
421 421
             ],
422 422
             'b' => [
423
-              [
423
+                [
424 424
                 'name' => 'User B',
425 425
                 'friends' => [
426
-                  ['name' => 'User A'],
426
+                    ['name' => 'User A'],
427 427
                 ],
428 428
                 'foes' => [
429
-                  ['name' => 'User C'],
429
+                    ['name' => 'User C'],
430
+                ],
430 431
                 ],
431
-              ],
432 432
             ],
433
-          ],
434
-          $result['data'],
435
-          'Retrieved data is correct.'
433
+            ],
434
+            $result['data'],
435
+            'Retrieved data is correct.'
436 436
         );
437 437
     }
438 438
 }
439 439
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $key = md5(serialize($ids));
59 59
         $this->buffer[$key] = $ids;
60 60
 
61
-        return function () use ($key) {
61
+        return function() use ($key) {
62 62
             return $this->fetch($key);
63 63
         };
64 64
     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             [
106 106
               'name' => 'name',
107 107
               'type' => new StringType(),
108
-              'resolve' => function ($value) {
108
+              'resolve' => function($value) {
109 109
                   return $value['name'];
110 110
               },
111 111
             ]
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             [
118 118
               'name' => 'friends',
119 119
               'type' => new ListType(new DeferredUserType($this->database)),
120
-              'resolve' => function ($value) {
120
+              'resolve' => function($value) {
121 121
                   return new DeferredResolver(
122 122
                     $this->database->add($value['friends'])
123 123
                   );
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             [
132 132
               'name' => 'foes',
133 133
               'type' => new ListType(new DeferredUserType($this->database)),
134
-              'resolve' => function ($value) {
134
+              'resolve' => function($value) {
135 135
                   return new DeferredResolver(
136 136
                     $this->database->add($value['foes'])
137 137
                   );
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
           [
152 152
             'name' => 'users',
153 153
             'type' => new ListType(new DeferredUserType($buffer)),
154
-            'resolve' => function ($value, $args) use ($buffer) {
154
+            'resolve' => function($value, $args) use ($buffer) {
155 155
                 return new DeferredResolver($buffer->add($args['ids']));
156 156
             },
157 157
           ]
Please login to merge, or discard this patch.
src/Execution/DeferredResolver.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,6 +25,6 @@
 block discarded – undo
25 25
     }
26 26
 
27 27
     public function resolve() {
28
-      return call_user_func($this->resolver);
28
+        return call_user_func($this->resolver);
29 29
     }
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.