Completed
Push — master ( e7842c...d7caa1 )
by Alexandr
03:20
created
src/Type/InterfaceType/AbstractInterfaceType.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -45,6 +45,9 @@
 block discarded – undo
45 45
         $this->config = new InterfaceTypeConfig($config, $this);
46 46
     }
47 47
 
48
+    /**
49
+     * @return AbstractType
50
+     */
48 51
     abstract public function resolveType($object);
49 52
 
50 53
     /**
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,9 @@
 block discarded – undo
59 59
     {
60 60
         if ($value instanceof AbstractObjectType) {
61 61
             foreach($value->getInterfaces() as $interface) {
62
-                if ($interface instanceof $this) return true;
62
+                if ($interface instanceof $this) {
63
+                    return true;
64
+                }
63 65
             }
64 66
         }
65 67
         return false;
Please login to merge, or discard this patch.
src/Type/InterfaceType/InterfaceType.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -25,6 +25,9 @@
 block discarded – undo
25 25
     {
26 26
     }
27 27
 
28
+    /**
29
+     * @param \Youshido\GraphQL\Type\Object\ObjectType $object
30
+     */
28 31
     public function resolveType($object)
29 32
     {
30 33
         return $this->getConfig()->resolveType($object);
Please login to merge, or discard this patch.
src/Type/NonNullType.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -50,6 +50,9 @@
 block discarded – undo
50 50
         return $value;
51 51
     }
52 52
 
53
+    /**
54
+     * @param null|Scalar\StringType $value
55
+     */
53 56
     public function isValidValue($value)
54 57
     {
55 58
         return $value !== null;
Please login to merge, or discard this patch.
src/Type/TypeService.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -117,6 +117,9 @@
 block discarded – undo
117 117
         return $type instanceof AbstractInputObjectType;
118 118
     }
119 119
 
120
+    /**
121
+     * @return \Youshido\GraphQL\Execution\ResolveInfo
122
+     */
120 123
     public static function getPropertyValue($data, $path)
121 124
     {
122 125
         if (is_object($data)) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
         if (is_object($data)) {
123 123
             $getter = $path;
124 124
             if (substr($path, 0, 2) != 'is') {
125
-                $getter = 'get' . self::classify($path);
125
+                $getter = 'get'.self::classify($path);
126 126
             }
127 127
 
128 128
             return is_callable([$data, $getter]) ? $data->$getter() : null;
Please login to merge, or discard this patch.
src/Validator/SchemaValidator/SchemaValidator.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
      * @param Field                 $objField
58 58
      * @param AbstractInterfaceType $interface
59 59
      *
60
-     * @return bool
60
+     * @return boolean|null
61 61
      *
62 62
      * @throws ConfigurationException
63 63
      */
Please login to merge, or discard this patch.
Tests/DataProvider/TestField.php 1 patch
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,13 +16,16 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
     /**
19
-     * @return AbstractObjectType
19
+     * @return IntType
20 20
      */
21 21
     public function getType()
22 22
     {
23 23
         return new IntType();
24 24
     }
25 25
 
26
+    /**
27
+     * @param string $value
28
+     */
26 29
     public function resolve($value, array $args, ResolveInfo $info)
27 30
     {
28 31
         return $value;
Please login to merge, or discard this patch.
Tests/DataProvider/TestInputField.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
     /**
19
-     * @return AbstractInputObjectType
19
+     * @return IntType
20 20
      */
21 21
     public function getType()
22 22
     {
Please login to merge, or discard this patch.
Tests/StarWars/Schema/QueryType.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
 
10 10
 
11 11
 use Youshido\GraphQL\Field\Field;
12
-use Youshido\GraphQL\Field\FieldFactory;
13 12
 use Youshido\GraphQL\Type\Object\AbstractObjectType;
14 13
 use Youshido\GraphQL\Type\Scalar\IdType;
15 14
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
                 'args'    => [
37 37
                     'episode' => ['type' => new EpisodeEnum()]
38 38
                 ],
39
-                'resolve' => function ($root, $args) {
39
+                'resolve' => function($root, $args) {
40 40
                     return StarWarsData::getHero(isset($args['episode']) ? $args['episode'] : null);
41 41
                 },
42 42
             ])
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                 'args'    => [
47 47
                     'id' => new IdType()
48 48
                 ],
49
-                'resolve' => function ($value = null, $args = []) {
49
+                'resolve' => function($value = null, $args = []) {
50 50
                     $humans = StarWarsData::humans();
51 51
 
52 52
                     return isset($humans[$args['id']]) ? $humans[$args['id']] : null;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                 'args'    => [
59 59
                     'id' => new IdType()
60 60
                 ],
61
-                'resolve' => function ($value = null, $args = []) {
61
+                'resolve' => function($value = null, $args = []) {
62 62
                     $droids = StarWarsData::droids();
63 63
 
64 64
                     return isset($droids[$args['id']]) ? $droids[$args['id']] : null;
Please login to merge, or discard this patch.
Tests/Schema/ProcessorTest.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -164,19 +164,19 @@
 block discarded – undo
164 164
         $this->assertEquals(['data' => ['me' => ['firstName' => 'JOHN']]], $processor->getResponseData());
165 165
 
166 166
         $schema->getMutationType()
167
-               ->addField(new Field([
168
-                   'name'    => 'increaseCounter',
169
-                   'type'    => new IntType(),
170
-                   'resolve' => function ($value, $args, ResolveInfo $info) {
171
-                       return $this->_counter += $args['amount'];
172
-                   },
173
-                   'args'    => [
174
-                       'amount' => [
175
-                           'type'    => new IntType(),
176
-                           'default' => 1
177
-                       ]
178
-                   ]
179
-               ]))->addField(new Field([
167
+                ->addField(new Field([
168
+                    'name'    => 'increaseCounter',
169
+                    'type'    => new IntType(),
170
+                    'resolve' => function ($value, $args, ResolveInfo $info) {
171
+                        return $this->_counter += $args['amount'];
172
+                    },
173
+                    'args'    => [
174
+                        'amount' => [
175
+                            'type'    => new IntType(),
176
+                            'default' => 1
177
+                        ]
178
+                    ]
179
+                ]))->addField(new Field([
180 180
                 'name'    => 'invalidResolveTypeMutation',
181 181
                 'type'    => new NonNullType(new IntType()),
182 182
                 'resolve' => function () {
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
     public function testSchemaOperations()
98 98
     {
99
-        $schema    = new Schema([
99
+        $schema = new Schema([
100 100
             'query' => new ObjectType([
101 101
                 'name'   => 'RootQuery',
102 102
                 'fields' => [
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                                     'args'    => [
110 110
                                         'shorten' => new BooleanType()
111 111
                                     ],
112
-                                    'resolve' => function ($value, $args) {
112
+                                    'resolve' => function($value, $args) {
113 113
                                         return empty($args['shorten']) ? $value : $value;
114 114
                                     }
115 115
                                 ],
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                                 'code'      => new StringType(),
118 118
                             ]
119 119
                         ]),
120
-                        'resolve' => function ($value, $args) {
120
+                        'resolve' => function($value, $args) {
121 121
                             $data = ['firstName' => 'John', 'code' => '007'];
122 122
                             if (!empty($args['upper'])) {
123 123
                                 foreach ($data as $key => $value) {
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
                     ],
137 137
                     'randomUser'        => [
138 138
                         'type'    => new TestObjectType(),
139
-                        'resolve' => function () {
139
+                        'resolve' => function() {
140 140
                             return ['invalidField' => 'John'];
141 141
                         }
142 142
                     ],
143 143
                     'invalidValueQuery' => [
144 144
                         'type'    => new TestObjectType(),
145
-                        'resolve' => function () {
145
+                        'resolve' => function() {
146 146
                             return 'stringValue';
147 147
                         }
148 148
                     ],
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
                ->addField(new Field([
168 168
                    'name'    => 'increaseCounter',
169 169
                    'type'    => new IntType(),
170
-                   'resolve' => function ($value, $args, ResolveInfo $info) {
170
+                   'resolve' => function($value, $args, ResolveInfo $info) {
171 171
                        return $this->_counter += $args['amount'];
172 172
                    },
173 173
                    'args'    => [
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
                ]))->addField(new Field([
180 180
                 'name'    => 'invalidResolveTypeMutation',
181 181
                 'type'    => new NonNullType(new IntType()),
182
-                'resolve' => function () {
182
+                'resolve' => function() {
183 183
                     return null;
184 184
                 }
185 185
             ]))->addField(new Field([
186 186
                 'name'    => 'interfacedMutation',
187 187
                 'type'    => new TestInterfaceType(),
188
-                'resolve' => function () {
188
+                'resolve' => function() {
189 189
                     return ['name' => 'John'];
190 190
                 }
191 191
             ]));
@@ -231,43 +231,43 @@  discard block
 block discarded – undo
231 231
                 'fields' => [
232 232
                     'listQuery'                 => [
233 233
                         'type'    => new ListType(new TestEnumType()),
234
-                        'resolve' => function () {
234
+                        'resolve' => function() {
235 235
                             return 'invalid list';
236 236
                         }
237 237
                     ],
238 238
                     'listEnumQuery'             => [
239 239
                         'type'    => new ListType(new TestEnumType()),
240
-                        'resolve' => function () {
240
+                        'resolve' => function() {
241 241
                             return ['invalid enum'];
242 242
                         }
243 243
                     ],
244 244
                     'invalidEnumQuery'          => [
245 245
                         'type'    => new TestEnumType(),
246
-                        'resolve' => function () {
246
+                        'resolve' => function() {
247 247
                             return 'invalid enum';
248 248
                         }
249 249
                     ],
250 250
                     'enumQuery'                 => [
251 251
                         'type'    => new TestEnumType(),
252
-                        'resolve' => function () {
252
+                        'resolve' => function() {
253 253
                             return 1;
254 254
                         }
255 255
                     ],
256 256
                     'invalidNonNullQuery'       => [
257 257
                         'type'    => new NonNullType(new IntType()),
258
-                        'resolve' => function () {
258
+                        'resolve' => function() {
259 259
                             return null;
260 260
                         }
261 261
                     ],
262 262
                     'invalidNonNullInsideQuery' => [
263 263
                         'type'    => new NonNullType(new IntType()),
264
-                        'resolve' => function () {
264
+                        'resolve' => function() {
265 265
                             return 'hello';
266 266
                         }
267 267
                     ],
268 268
                     'objectQuery'               => [
269 269
                         'type'    => new TestObjectType(),
270
-                        'resolve' => function () {
270
+                        'resolve' => function() {
271 271
                             return ['name' => 'John'];
272 272
                         }
273 273
                     ],
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
                                 'enum'   => new TestEnumType(),
280 280
                             ],
281 281
                         ]),
282
-                        'resolve' => function () {
282
+                        'resolve' => function() {
283 283
                             return [
284 284
                                 'object' => [
285 285
                                     'name' => 'John'
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
             ]
349 349
         ]);
350 350
 
351
-        $union        = new UnionType([
351
+        $union = new UnionType([
352 352
             'name'        => 'TestUnion',
353 353
             'types'       => [$object1, $object2],
354
-            'resolveType' => function ($object) use ($object1, $object2) {
354
+            'resolveType' => function($object) use ($object1, $object2) {
355 355
                 if (isset($object['id'])) {
356 356
                     return $object1;
357 357
                 }
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
         $invalidUnion = new UnionType([
363 363
             'name'        => 'TestUnion',
364 364
             'types'       => [$object1, $object2],
365
-            'resolveType' => function ($object) use ($object3) {
365
+            'resolveType' => function($object) use ($object3) {
366 366
                 return $object3;
367 367
             }
368 368
         ]);
369
-        $processor    = new Processor(new Schema([
369
+        $processor = new Processor(new Schema([
370 370
             'query' => new ObjectType([
371 371
                 'name'   => 'RootQuery',
372 372
                 'fields' => [
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
                         'args'    => [
376 376
                             'type' => ['type' => 'string']
377 377
                         ],
378
-                        'resolve' => function ($value, $args) {
378
+                        'resolve' => function($value, $args) {
379 379
                             if ($args['type'] == 'object1') {
380 380
                                 return [
381 381
                                     'id' => 43
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
                     ],
390 390
                     'invalidUnion' => [
391 391
                         'type'    => $invalidUnion,
392
-                        'resolve' => function () {
392
+                        'resolve' => function() {
393 393
                             return ['name' => 'name resolved'];
394 394
                         }
395 395
                     ],
Please login to merge, or discard this patch.